
Debashis Pyne
Top achievements
Rank 1
Debashis Pyne
asked on 24 Sep 2010, 08:19 AM
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.
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.
5 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 24 Sep 2010, 12:37 PM
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.
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.
0
Accepted
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
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
0

Debashis Pyne
Top achievements
Rank 1
answered on 24 Sep 2010, 03:47 PM
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
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
0

Cori
Top achievements
Rank 2
answered on 24 Sep 2010, 06:56 PM
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.
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.
0

Debashis Pyne
Top achievements
Rank 1
answered on 27 Sep 2010, 04:13 PM
Hi,
Thanks a lot.
This works great :)
--
Regards,
Debashis
Thanks a lot.
This works great :)
--
Regards,
Debashis