// Removes TextBox / Label / Add implementation / Add and remove keyword / Params protected void RemoveKeywordField(int keywordIndex, bool removeFromList) { FormControls.RemoveControlByKey("DynamicStep" + keywordIndex + "Name", Controls); FormControls.RemoveControlByKey("DynamicStep" + keywordIndex + "Label", Controls); FormControls.RemoveControlByKey("DynamicStep" + keywordIndex + "AddImplementation", Controls); FormControls.RemoveControlByKey("DynamicStep" + keywordIndex + "AddKeyword", Controls); FormControls.RemoveControlByKey("DynamicStep" + keywordIndex + "RemoveKeyword", Controls); FormControls.RemoveControlByKey("DynamicStep" + keywordIndex + "Params", Controls); if (removeFromList) { ThisFormKeywords.RemoveAt(keywordIndex - 1); } }
public void RemoveKeywordFromThisForm(object sender, EventArgs e) { AssignThisKeywordNamesFromTextFields(); if (NumberOfKeywordsInThisForm <= 1) { return; } var keywordIndex = int.Parse(((Button)sender).Name.Replace("DynamicStep", "").Replace("RemoveKeyword", "")); RemoveKeywordField(NumberOfKeywordsInThisForm, false); ThisFormKeywords.RemoveAt(keywordIndex - 1); NumberOfKeywordsInThisForm--; for (var i = 1; i <= NumberOfKeywordsInThisForm; i++) { Controls["DynamicStep" + i + "Name"].Text = ThisFormKeywords[i - 1].Name.Trim(); } for (var i = 1; i <= NumberOfKeywordsInThisForm; i++) { ((TextWithList)Controls["DynamicStep" + i + "Name"]).TriggerUpdate(ThisFormKeywords[i - 1].Name, ThisFormKeywords[i - 1].ToString()); ((TextWithList)Controls["DynamicStep" + i + "Name"]).EnableKeywordFields(); } }