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) {
}
Hi Angel,
I had taken your advice and set SelectionChanged to Off(<AutoPostBackFlags ValueChanged="On" />),
but still don't work. Oh...How can i do now?
Since you have AutoPostBack flags for both SelectionChanged and ValueChanged defined, value changed will never be invoked, because selection happens first, and causes a postback immediately, only after that the value change code is executed on the client, but because of the postback, it doesn't get actually executed in your case.
I suggest removing autoPostBackFlag for SelectionChanged (or setting it to Off, which is the default value). This way you will still get the selection changed events fire on the server, but only the postback will be triggered by the value change event from the client.
Hope this helps,
Angel