Hi,
I have a created a Hierarchy grid in code behind with NestedViewTemplate. In the template I have radtextbox,checkbox,radcombo .
My problem is how to assign and reterive data from them in code behind and the data is coming from database.
please help me......
regards
Sathies
I have a created a Hierarchy grid in code behind with NestedViewTemplate. In the template I have radtextbox,checkbox,radcombo .
My problem is how to assign and reterive data from them in code behind and the data is coming from database.
please help me......
regards
Sathies
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 18 Feb 2009, 09:56 AM
Hi Sathies,
Hope you are trying to access the controls in the NestedViewTemplate on expanding the master table. Try the following code snippet and see if it helps.
CS:
Thanks
Shinu
Hope you are trying to access the controls in the NestedViewTemplate on expanding the master table. Try the following code snippet and see if it helps.
CS:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == "ExpandCollapse") |
{ |
GridDataItem item = (GridDataItem)e.Item; |
GridNestedViewItem nestedItem = (GridNestedViewItem)item.ChildItem; |
RadTextBox txtbx = (RadTextBox)nestedItem.FindControl("RadTextBox1"); |
//to access the Text from the TextBox |
string strCurrentText = txtbx.Text; |
//to set text in RadTextBox |
txtbx.Text = "NewText"; |
} |
} |
Thanks
Shinu
0
sathies
Top achievements
Rank 1
answered on 18 Feb 2009, 12:06 PM
Hi Shinu,
Thanks, its works fine.
Is there any way to differentiate Expand and Collpase ie) I want to load data during Expansion and save data when Collapsed.
regards,
Sathies
Thanks, its works fine.
Is there any way to differentiate Expand and Collpase ie) I want to load data during Expansion and save data when Collapsed.
regards,
Sathies
0
Shinu
Top achievements
Rank 2
answered on 19 Feb 2009, 04:13 AM
Hi Sathies,
Try the following code snippet to achieve the desired scenario.
CS:
Thanks
Shinu
Try the following code snippet to achieve the desired scenario.
CS:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.CommandName == "ExpandCollapse") |
{ |
//to save data when collapsed |
if (e.Item.Expanded) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
GridNestedViewItem nestedItem = (GridNestedViewItem)item.ChildItem; |
RadTextBox txtbx = (RadTextBox)nestedItem.FindControl("RadTextBox1"); |
//to access the Text from the TextBox |
string strCurrentText = txtbx.Text; |
} |
//to load data during Expansion |
else if (!e.Item.Expanded) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
GridNestedViewItem nestedItem = (GridNestedViewItem)item.ChildItem; |
RadTextBox txtbx = (RadTextBox)nestedItem.FindControl("RadTextBox1"); |
//to set text in RadTextBox |
txtbx.Text = "NewText"; |
} |
} |
} |
Thanks
Shinu
0
sathies
Top achievements
Rank 1
answered on 20 Feb 2009, 05:45 AM
Hi Shinu,
Thanks, Its works fine
regards
Sathies
Thanks, Its works fine
regards
Sathies