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
110
WebDropDown - SelectedValue with OnSelectionChanged
posted

I'm using the WebDropDown and posting back with OnSelectionChanged.  When it posts back I try to access the SelectedValue property but it has no value.  In my debugger the value shows as "{"Object reference not set to an instance of an object."}".  Why would this not have the value of the item I selected from the drop down?  Code below...

 <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="True" runat="server" />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

    <ContentTemplate>

    <ig:WebDropDown
 ID="wdd_AddAgent"
 Width="250px"
 OnPreRender="ClientFiltering_PreRender"
 EnableAutoCompleteFirstMatch="false"
 DropDownContainerHeight="300px"
 EnableViewState="false" 
 EnableAutoFiltering="Client" 
 OnSelectionChanged="Populate_Default_Commission" 
 AutoPostBackFlags-SelectionChanged="Async"
 runat="server">
    </ig:WebDropDown>

    <br /><br />

    <asp:Button ID="btn_AddAgent" runat="server" Text="Add Agent" />

    </ContentTemplate>

    </asp:UpdatePanel>

 

    Protected Sub Populate_Default_Commission(ByVal sender As Object, ByVal e As System.EventArgs)

        If Not wdd_AddAgent.SelectedValue Is Nothing Then

        End If

    End Sub

 

Parents
No Data
Reply
  • 110
    posted

    Also, here's how I'm populating the items in the drop-down:

    wdd_AddAgent.DataSource = DataSet1.Tables(0)
    wdd_AddAgent.ValueField = "agent_id"
    wdd_AddAgent.TextField = "agent_name"

    When I post back with OnSelectionChanged and look at the properties of theWebDropDown, the CurrentValue property has the value of the "agent_name" value for the item I selected.  Shouldn't CurrentValue have the value of the "agent_id" that I defined for the ValueField?

     

     

Children