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
240
Webdropdown,selectionchanged and valuechangedEvent is not working
posted

Hi,

I am using webdropdown in my page (This control is not inside any template)

I binded items in webdropdown by using the following code

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

LoadDropDown()

End Sub



Private Sub LoadDropDown()

Dim result = From a In objContext.LabelData_Vw
Select a
ddlIdNumber.DataSource = result.ToList()
ddlIdNumber.ValueField = "intRowID"
ddlIdNumber.TextField = "vchIDNumber"
ddlIdNumber.EnableAutoCompleteFirstMatch = False
ddlIdNumber.EnableAutoFiltering = Infragistics.Web.UI.ListControls.AutoFiltering.Server
ddlIdNumber.AutoFilterQueryType = Infragistics.Web.UI.ListControls.AutoFilterQueryTypes.Contains
ddlIdNumber.EnableViewState = False
ddlIdNumber.AutoFilterResultSize = 50
ddlIdNumber.EnableLoadOnDemand = True
ddlIdNumber.AutoFilterTimeoutMs = 200
ddlIdNumber.DataBind()
End Sub

in 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 query

if 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 fire

if i try to clear the last letter of the first list item in the dropdown list

means "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_mail

the 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 know

waiting for your earlier response

Parents
No Data
Reply
  • 29417
    Offline posted

    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://ko.infragistics.com/support

     

Children