activate ModalPopupExtender and tell the TargetControlID wiche button is activate it

julieistanbul

New Member
I am Writhing an web app in asp.net i have the following code:asp page:\[code\]<ajaxToolkit:ToolkitScriptManager ID="toolKitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager><ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderSelectFilds" runat="server" PopupControlID="popUpPanelSelectFields" BackgroundCssClass="modalBackground" OkControlID="ButtonOk" BehaviorID="modalPopupExtenderSelectFilds"></ajaxToolkit:ModalPopupExtender><asp:Panel ID="popUpPanelSelectFields" runat="server" CssClass="confirm-dialog" BorderColor="Aqua" > <br/> <asp:Label ID="LabelMessageToTeacher" runat="server" Text="" /><br/> <asp:TextBox ID="TextBoxMessageToTeacher" runat="server" Width="200px" Height="50px"/><br/><br/> <asp:CheckBox ID="CheckBoxSkype" runat="server" Text="" /><br/> <asp:CheckBox ID="CheckBoxPhoneNumber" runat="server" Text="" /><br/><br/> <asp:Button ID="ButtonOk" runat="server" Text="Ok" /></asp:Panel>\[/code\]code behind:\[code\]ModalPopupExtenderSelectFilds.TargetControlID = "GetSelectedTeacher1";public void GetSelectedTeacher1(object o , EventArgs e){ Button button = (Button)o; int selectedTeacherId = int.Parse(button.ID); } \[/code\]class:\[code\]Button button = new Button();button.Click += new EventHandler(m_ButtonClickActivateFunction);\[/code\]in the aspx code i have the code for my \[code\]ModalPopup\[/code\] window, in the code behind I havea function (\[code\]GetSelectedTeacher1\[/code\]) that i send to the class using Action function (and then insert to the event button the function that here name is now \[code\]ButtonClickActivateFunction\[/code\] )and then the class build me a multiple buttons that if i click on one of the buttons i go to the \[code\]GetSelectedTeacher1\[/code\] function on the code behind of the aspx.the problem is that i always get this error:\[quote\] "The TargetControlID of 'ModalPopupExtenderSelectFilds' is not valid. A control with ID 'GetSelectedTeacher1' could not be found."\[/quote\]how can i tell the \[code\]TargetControlID\[/code\] that when i click on one of the buttons to activate the \[code\]ModalPopupExtender\[/code\]?I hope I was clearthanks.
 
Back
Top