Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
769
urgent: How to use OnSelectedIndexChanged for Dropdownlist?
posted

Hello everyone,

 I have an ultrawegrid that I have two dropdownlists. Both dropdownlists are templatedcolumns (that means I'm using a Standard ASP.NET 2.0 dropdownlist control).  For both dropdownlist I use the OnLoad method to load my dropdownlist with items.  In the dropdownlist control I specified the OnSelectedIndexChanged and so everytime I click an item from the dropdownlist it suppose to fire an event from the OnSelectedIndexChanged but it doesn't. I tested with another dropdownlist on the same page but not embeded into the webgrid and it does fire the OnSelectedIndexChanged event.  Can anyone tell me why I can't fire the OnSelectedIndexChanged when I use it as a templatedcolumn?

 Also, is it right for me to use the OnLoad event method to initialize my dropdownlist items??

Here is a snippet of my code:

<CellTemplate> 

<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True">

<asp:ListItems Text="(Select)" Value="" Enabled="True" Selected="True"/>
</asp:DropDownList>

</CellTemplate>
 

public void DropDownList1_SelectedIndexChanged(object sender, EventArgs e){

 //Do something...

}

 If you know a way or a solution, please let me know asap.

 Thanks very much in advance!

HS2