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) {
}
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
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 your feedback. You can take a look at the following sample (it demonstrates what you are asking):
http://samples.infragistics.com/2009.1/WebFeatureBrowser/Default.aspx => on the left menu WebDropDown => Server Events.
On the other hand, if Page_load is not hit at all, then there is no postback, so neither of ValueChanged or SelectionChanged will be triggered.
You have two options:
1) set AutoPostback to On => this will make both ValueChanged and SelectionChanged AutoPostbackFlags to On
2) set AutoPostBackFlag On for ValueChanged or
3) set AutoPostBackFlag On for SelectionChanged (will also trigger the event handler for ValueChanged, if such is registered in the code behind/aspx).
Thanks,
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.
In your sample you also have AutoPostBack="True". This will make all autopostback flags set to On, including the SelectionChanged. You should set this to False, or not set it at all.