Passing ID to the server

3 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 23 Dec 2009 Link to this post

    Going through this example
    http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/treeviewcombobox/defaultcs.aspx?product=treeview
    of using the TreeView inside a RadCombo, Its the text values that is sent to the server, how would I get the ID to the serverside. I have added the autopostback = true as depending on the ID I have to do other things.

    Andy
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Dec 2009 Link to this post

    Hi Andy,

    I guess you want to retrieve the selected node's value in server side. If so one suggestion will be accessing the RadTreeView and get the node which is selected to access the value.

    CS:
     
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            RadComboBox1.Items[0].Text = RadComboBox1.Text; 
            RadTreeView treeview = (RadTreeView)RadComboBox1.Items[0].FindControl("RadTreeView1"); 
            RadTreeNode node = (RadTreeNode)treeview.SelectedNode; 
            Label1.Text = node.Value; 
     
        } 

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 23 Dec 2009 Link to this post

    Thanks Shinu.

    This is great where I need the ID there and then, but I also have a situation where I wont need the ID until the form is submitted.

    How would I modify the Javascript function provided in the example to put an ID / Name into the Rad Combo box. Then I can use the me.radcombobox.selectedvalue ect..... and it will save a postback when the user selects a value.

    This is the function as provided by your selves:
            function nodeClickingLocation(sender, args)  
            {  
                var comboBox = $find("<%= txtLocation.ClientID %>");  
                var node = args.get_node()  
                comboBox.set_text(node.get_text());  
                comboBox.trackChanges();  
                comboBox.get_items().getItem(0).set_value(node.get_text());  
                comboBox.commitChanges();  
                comboBox.hideDropDown();  
            } 

    Also
    The controls seem to ignore AJAX, in that they do a full page refresh. Originally I had all the control in a RadAjaxPanel, but I've changed to a RadAjaxManager, but it the same either way, any ideas.

    Andy
Back to Top