Hi,I am using webdropdown in my page (This control is not inside any template)I binded items in webdropdown by using the following codeProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadLoadDropDown()End SubPrivate Sub LoadDropDown()Dim result = From a In objContext.LabelData_VwSelect addlIdNumber.DataSource = result.ToList()ddlIdNumber.ValueField = "intRowID"ddlIdNumber.TextField = "vchIDNumber"ddlIdNumber.EnableAutoCompleteFirstMatch = FalseddlIdNumber.EnableAutoFiltering = Infragistics.Web.UI.ListControls.AutoFiltering.ServerddlIdNumber.AutoFilterQueryType = Infragistics.Web.UI.ListControls.AutoFilterQueryTypes.ContainsddlIdNumber.EnableViewState = FalseddlIdNumber.AutoFilterResultSize = 50ddlIdNumber.EnableLoadOnDemand = TrueddlIdNumber.AutoFilterTimeoutMs = 200ddlIdNumber.DataBind()End Subin markup page i used this following code<ig:WebDropDown ID="ddlIdNumber" runat="server" Width="100px"OnSelectionChanged="ddlIdNumber_SelectionChanged" OnValueChanged="ddlIdNumber_ValueChanged" AutoPostBackFlags-ValueChanged="On"><ClientEvents /></ig:WebDropDown>Her i need to filter the dropdown list as well as while selecting the item in the dropdown list i need to pass the selected value or current value to queryif i selecting the item in the list it is firing to the value changed event and i can see the Old value and new value after that the selection cahnged is getting fireif i try to clear the last letter of the first list item in the dropdown listmeans "xx11.123"-> '3' it showing the new value as "xx11.12" ,but after no filtering is take place this is one issue (so filtering is one issue)if i am suppose passing the new value to my query in value changed event like Dim result = From a In objContext.SupplierDetailsByMFG_Vw Where a.vchIDNumber = e.newvalue.tostring() Select a For Each res In result txtContactPerson.Text = res.ContactPerson txtTelephoneNumber.Text = res.Telephone txtFaxNumber.Text = res.Fax txtEmailAddress.Text = res.E_mailthe text box assigned the value from query but it is not displaying the text in textbox in the page(value is not showing in the page this is another issue)so please let me knowwaiting for your earlier response
Hello tctsaravanakumar ,
I’m not completely sure I’ve understood you exact scenario but here are some of the things that I’ve noticed that might be causing your issues.
1)Regarding your first issue. It seems to be caused by a conflict between the ajax call and the postback that trigger one after the other.
You’ve set the AutoPostback property for ValueChanged to on but at the same time since AutoFiletring is set to on server.What is happening when you change any value in the WebdropDown is that the drop down makes an ajax call to the server once( because of the AutoFiletring ) and then a fullpage postback again (because of the AutoPostback flag). Furthermore because of the full page postback and the fact that you’ve disabled the ViewState when your page loads the DropDown will have lost the current selection, current value and other properties that are by default kept in the View state so it will not filter the items. So this is what’s causing your first issue. Here are your options to resolve this depending on your scenario.
1.You could disable the Autopostback for ValueChanged. This way it will make ajax calls to retrieve the autofiltered data on each value change.
2.You could disable the AutoFiltering and keep the AutoPostback flag. With this option you’ll have make a manual filtering on the server side in the ValueChange event and then when you retrieve the filtered data ,clear the old data source for the drop down and databind to the new filtered one.
2) Regarding your second issue. If you want the values for the text boxes to be changed during the ValueChanged event you’ll need to trigger a full page postback and not an ajax call. Otherwise the changes will not be reflected.
Let me know if you have any further questions or if I’ve misunderstood something from your scenario.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Hello maya,
Thanks for your previous reply
Now i am doing like this
<ig:WebDropDown ID="ddlMRBID" runat="server" Width="100px"> </ig:WebDropDown>
and i binded like
Private Sub LoadDropDownMRBID() Dim result = From a In objContext.MRB_Ta Select a.intRowID, a.vchMRB_ID ddlMRBID.ValueField = "intRowID" ddlMRBID.TextField = "vchMRB_ID" ddlMRBID.DataSource = result.ToList() ddlMRBID.DataBind() ddlMRBID.AutoFilterTimeoutMs = 200 ddlMRBID.Items.Insert(0, New DropDownItem("", 0)) End Sub
and i set the selection changed event for this dropdown
Protected Sub ddlMRBID_SelectionChanged(sender As Object, e As Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs)
Dim ad As String = ddlMRBID.SelectedValue End Sub
the selection changed event is not firing
once i set the auyopostflag:selectionchanged as Asynch (or) On ,it get firing this event
but still it showing the selected value as empty value (" ")
so that i tried to achieve through e.newvalue, by doing like this i get the selected text and proceed with that "selected text" to the query and assigned to the "text box" value in the page from query
so whatever i did just took a glance,i will explain what i want to do so that it will easy for you giving the exact solution
In the dropdown list the "FILTERATION" want to done
by the filtered value
if i am selecting the item "selected value" it want to bind another DropDown list and also assign some values to the text box
for each filtering take place in the dropdownlist this above task want to done
please advice me
i am stucking in this task for nearly TWO days and waiting for you quick response
Let me know if I understood your scenario correctly.
Your web drop down has to filter on each value changing based on the new (changed) value and when you select a value from the drop down you want to show some text from your query into some textboxes.
I’ve prepared a sample for your reference. Here is some additional information that you might find useful:
1)For the event in which you’re setting the text of the textboxes you’ll need to set an autopostback flag to trigger a full page postback so that the changes will be made to the text boxes. So in your case set the autopostback flag for SelectionChanged to On. Also set the AutoSelectOnMatch property of the WebDropDown to false. This is due to the fact that when it’s on the selection would trigger on every value change .
2) If you want to persist the current filtered values over postbacks (for example when you filter by some value and then select a value from the drop down and you would want that filtered values to be persisted when the page reloads) you’ll need the EnableViewState="true" and EnableAjaxViewState="true".
3) You can get the new selection trough the e.NewSelection which would return the index of the selected item. To persist the selection itself you’ll need to in the SelectionChanged event the current item to be selected and also set the CurrentValue property to the current item’s value”
Ex:
protected void WebDropDown1_SelectionChanged(object sender, Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs e)
{
var currentVal = WebDropDown1.Items[Convert.ToInt32(e.NewSelection)].Text;
int index = Convert.ToInt32(e.NewSelection);
WebDropDown1.CurrentValue = currentVal;
WebDropDown1.Items[index].Selected = true;
text1.Text = currentVal;
}
Please refer to the attached sample and let me know if this is similar to your scenario. If not please feel free to modify this sample to better depict your scenario.
Thank you for your cooperation.