Hi,
I binding the webdropdown with sqldatasource, but when i choosed the dropdown item,can not cause
the ValueChanged event to fire.
Those are my codes.
CLIENT:
<ig:WebDropDown ID="dpEmp" runat="server" Width="200px" EnableAutoFiltering="Client" DropDownContainerHeight="300px" DataSourceID="SqlDataSource1" TextField="CN" AutoFilterQueryType="Contains" AutoFilterResultSize="100" AutoFilterTimeoutMs="2000" AutoPostBack="True" onvaluechanged="dpEmp_ValueChanged" DataKeyFields="Code" ValueField="Code" > <DropDownItemBinding TextField="CN" ValueField="Code"></DropDownItemBinding> <AutoPostBackFlags SelectionChanged="On" ValueChanged="On" /> </ig:WebDropDown>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ExpenseLineConnectionString %>" SelectCommand="SELECT Code+Name AS CN, Code FROM TCCEmp WHERE (CCEmp = @CCEmp)"> <SelectParameters> <asp:Parameter DefaultValue="E" Name="CCEmp" Type="String" /> </SelectParameters> </asp:SqlDataSource>
SERVER:
protected void dpEmp_ValueChanged(object sender, Infragistics.Web.UI.ListControls.DropDownValueChangedEventArgs e) {
}
I'm seeing exactly the same behavior. To simplify things and get away from any complications caused by my SQL data source, I created a page with nothing on it other than a simple WedDropDown with a hard coded list of items. No matter what combination of "autopostback" properties I select, neither the SelectionChanged nor ValueChanged events in the VB code behind file fire. Additionally, since I also set a breakpoint in the Page_Load event, I can see that no postback at all is taking place, let alone having those events triggered.
I found another post where Angel suggests adding a <ClientEvents /> declaration and that at least got the events to fire.
<ig:WebDropDown ID="cboSimple" ... MultipleSelectionType="Checkbox" PageSize="0"> <ClientEvents /> <AutoPostBackFlags SelectionChanged="On" /> <Items>
But there still two "minor" issues. (1) Regardless of the combination of SelectionChanged = On/Off and ValueChanged = On/Off, if either is set, both events fire if they have code. (2) The response to the users click on an item in the drop down list is very slow. It takes about 3 seconds to see a response on my system, and that's without the code doing anything other than assigning a string variable.
Thanks for bringing this up. The presence of the <ClientSideEvents /> so that the events fire is a known issue and has already been fixed. Should be out in the next Service Release for this month.
This is the correct behavior - both will fire, because when you select an item, the value is also automatically updated. If you don't want ValueChanged to fire, add a handler for the ValueChanging client-side event, and cancel it :
args.set_cancel(true);
If your AutoPostBackFlag is set to Async, it's normal for selection to be slow, because depending on round-trip time, from the time you select, until the response is back, it does an async postback. 3 seconds is too much, i would investigate what is being invoked on the server-side, maybe DataBinding is called and takes a lot of time. In that case you can use either the Paging or LoadOnDemand features, which will limit the initial number of items rendered and data-bound. (now i see in your example you are not using any sort of databinding to an sql data source or similar) in that case you can investigate using FireBug for example, how long it takes for the response to arrive in terms of network latency. Do you run this locally? If you are using Firefox, you may also try changing "localhost" to "127.0.0.1", it causes well-known DNS issues when combined with the development server, instead of IIS.
Hope this helps,
Angel