Return DataValueField text

5 posts, 1 answers
  1. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 03 Apr 2013 Link to this post

    Having setup my Autocompletebox properly and returning values, I now need to take the DataValueField and update the database when they click the update button.  However in my code-behind I am unable to reference the selectedvalue. 

    <telerik:RadAutoCompleteBox ID="radEmailUser" runat="server"
        DataSourceID="SqlDataSource1"  DataTextField="Contact_Email"
        DataValueField="EmailListID" Filter="StartsWith" InputType="Text"
        Width="300px" DropDownWidth="300px" TextSettings-SelectionMode="Single">
        <DropDownItemTemplate>
        <table><tr><td>
            <%# DataBinder.Eval(Container.DataItem, "contact_Email")%> (
            <%# DataBinder.Eval(Container.DataItem, "first_name")%>  
            <%# DataBinder.Eval(Container.DataItem, "last_name")%>)
            </td></tr></table>
        </DropDownItemTemplate>
    </telerik:RadAutoCompleteBox>

    I would like to get the value (EmailListID) that is selected and pass that onto a stored procedure for updating.  Unable to properly reference the value.  How can I get the value?

  2. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 08 Apr 2013 Link to this post

    Update on this post:  Didn't use the AutoCompletebox because was too slow and couldn't get the value I was looking for.  Used a RadComboBox instead and it worked in a similar fashion but much faster. 

    Thanks
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 08 Apr 2013 Link to this post

    Hello Kurt,

    I noticed that you had enabled a Single selection mode of the RadAutoCompleteBox control. Therefor, I would suggest you to access the entry's value in the following manner (in a Button_Click event handler for example): radEmailUser.Entries[0].Value;. Here is video, demonstrating the behavior at my end, implementing the above suggestion.

    Kind regards,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. Thomas
    Thomas avatar
    1 posts
    Member since:
    Dec 2014

    Posted 17 Dec 2014 in reply to Kurt Kluth Link to this post

    So how did you end up getting the DataValueField value?
  6. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 19 Dec 2014 in reply to Thomas Link to this post

    Thomas, 

    I don't recall and a search for the control came up empty to provide you a solution that we ended up implementing.  Sorry.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017