Selecting data from a Radwindow

6 posts, 1 answers
  1. Debashis Pyne
    Debashis Pyne avatar
    66 posts
    Member since:
    Apr 2010

    Posted 24 Sep 2010 Link to this post

    Hi,

    I have a tree view control (generated from DB) which opens in a rad window.
    I want to select a particular node of the tree and then click on the "Select" button.

    After clicking the select button - the radwindow should close and the selected data should be displayed in a textbox.
    All this is working, however when I click the select button - a pop up comes over saying to resend data to the server - which is irritating. I guess this is beacuse I am trying to pass data via server side.

    Any idea how this data should be tranferred via client side? May be using JS or sort of.

    Thanks.

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

    Posted 24 Sep 2010 Link to this post

    Hello,


    The help article shows how to pass the value from RadWindow to main page. I hope this would help you.
    Using RadWindow as a Dialog


    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 24 Sep 2010 Link to this post

    Hello Debashis,

    I prepared a small sample that shows how to do that with client-side code. I hope this helps.

    Regards,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Debashis Pyne
    Debashis Pyne avatar
    66 posts
    Member since:
    Apr 2010

    Posted 24 Sep 2010 Link to this post

    Hi,

    Thanks for these suggestions.

    However I still have an issue.
    When I select a node in the treeview and click the select button - the system fails to find the value of the node as it uses the "get_value()" method.

    Please note the code that we are using:

    1. Binding the treeview with the DB:

    protected void GenerateCompanyTree()
    {
    DataTable DtCompany;
    JOMCMiddleWare.BL.CompanyStructure oCompanyStructure = new JOMCMiddleWare.BL.CompanyStructure();

    oCompanyStructure._Module_Id = oCompanyStructure._Module_Id;
    oCompanyStructure._Language_Id = Convert.ToInt32(Session[JOMCSession.__Session_Lanuage_Id]);
    oCompanyStructure._Company_Id = Convert.ToInt32(Session[JOMCSession.__Session_Company_Id]);
    DtCompany = oCompanyStructure.GetDataAllTreeViewCompanyStructure();

    if (DtCompany.Rows.Count > 0)
    {
    RadTreeViewCompany.DataSource = DtCompany;
    RadTreeViewCompany.DataTextField = "Module_Content_Text";
    RadTreeViewCompany.DataFieldID = "Company_Id";
    RadTreeViewCompany.DataFieldParentID = "Company_Parent_Id";
    RadTreeViewCompany.DataBind();
    RadTreeViewCompany.ExpandAllNodes();
    }
    }


    2. JS method to extract data:
    function getSelectedNode() {
    var treeview = $find("<%= RadTreeViewCompany.ClientID %>");
    var selectedValue = treeview.get_selectedNode().get_value();
    alert(treeview);
    alert("Selected Node's value is: " + selectedValue + "\n Sending it to parent and closing the window now");
    var oWnd = GetRadWindow();
    oWnd.close(selectedValue);
    }

    The alert "alert("Selected Node's value is: " + selectedValue + "\n Sending it to parent and closing the window now");" states that the selectedvalue variable has NULL value.

    Any ideas?

    Thanks,
    Debashis
  6. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 24 Sep 2010 Link to this post

    Hello Debashis,

    I noticed that you are not setting the DataValueField property in your code, which would be the reason for the null value.

    I hope that helps.
  7. Debashis Pyne
    Debashis Pyne avatar
    66 posts
    Member since:
    Apr 2010

    Posted 27 Sep 2010 Link to this post

    Hi,

    Thanks a lot.
    This works great :)

    --
    Regards,
    Debashis
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017