how to retrieve values to my rad text box, using SQLDataSource

4 posts, 0 answers
  1. Hamza
    Hamza avatar
    24 posts
    Member since:
    Feb 2011

    Posted 20 Sep 2011 Link to this post

    Hi all :)

    I have a SQLData source, connected to radlistbox

    I want to retrieve some data when I choose an item

    suppose here is my table

    - Video ID
    - Video Name
    - Video Path

    I want to ( for example ) to retrieve the name and the path when I choose an Item inside my listbox and set it as a text in atextbox

    how can I do that ?

    thank you all :)
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Sep 2011 Link to this post

    Hello Hamza,

    You can hook RadListBox1_SelectedIndexChanged and access the selected Item
    protected void RadListBox1_SelectedIndexChanged(object sender, EventArgs e)
            TextBox1.Text = RadListBox1.SelectedItem.Text;

  3. DevCraft R3 2016 release webinar banner
  4. Rohit
    Rohit avatar
    4 posts
    Member since:
    Jul 2011

    Posted 23 Sep 2011 Link to this post

    In continuation to the above question:

    How would I retrieve the VideoID?
    (Assuming I am not displaying the VideoID.. I am just displaying the Video Name & Path)

    Thanks !!
  5. Peter Filipov
    Peter Filipov avatar
    1028 posts

    Posted 28 Sep 2011 Link to this post

    Hello Rohit,

    RadListBox control can be bind as follow:
    RadListBox1.DataTextField = "VideoID";
    RadListBox1.DataValueField = "VideoName";
    RadListBox1.DataKeyField = "VideoPath";

    All the values can be retrieved on server side as properties of the RadListBoxItem.

    Kind regards,
    Peter Filipov
    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
Back to Top