Hello,
I wonder if it is possible to run a C# function if ANY control that exists inside the updatepanel is changed. This code works if any of the 2 dropdownlists is changed or if the button is clicked. So I have put all 3 controlIDs in the "<Triggers>".
The problem now is that I will have about 200 dropdownlists and 200 buttons and like to avoid putting all of them in the "<Triggers>".
I wonder if that is possible to do and if so how to do that for the below code?
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" ><ContentTemplate><asp:Button ID="Button1" runat="server" Text="button" Width="271px" OnClick="dosomething_Click" /><asp:DropDownList ID="DropDownList1" runat="server" Width="121px" AutoPostBack="true" onselectedindexchanged="dosomething_Click"><asp:ListItem>1</asp:ListItem><asp:ListItem>2</asp:ListItem></asp:DropDownList><asp:DropDownList ID="DropDownList2" runat="server" Width="121px" AutoPostBack="true" onselectedindexchanged="dosomething_Click"><asp:ListItem>1</asp:ListItem><asp:ListItem>2</asp:ListItem></asp:DropDownList></ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click"/> <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" /> <asp:AsyncPostBackTrigger ControlID="DropDownList2" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel>
//C# code
protected void dosomething_Click()
{
//dosomething
}