
TechSavvySam
Top achievements
Rank 1
TechSavvySam
asked on 12 Nov 2012, 09:25 PM
I have a RadGrid with a DetailTable in it. When I expand a row in the MasterView to show the Detail, I want to change the detail row's Edit link text based on the data in the detail row.
For example if the row has col1="Blah", then I want the edit text to be "Edit Blah" instead of "Edit".
What's the easiest way to do this?
For example if the row has col1="Blah", then I want the edit text to be "Edit Blah" instead of "Edit".
What's the easiest way to do this?
4 Answers, 1 is accepted
0

Elliott
Top achievements
Rank 2
answered on 13 Nov 2012, 07:31 PM
use the same functionality that sets the focus on a quantity textbox
in the ItemDataBound event handler of the grid
make sure it's the edit item
Dim geItem As GridEditableItem = Nothing
Dim rntbQty As RadNumericTextBox
If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
geItem = DirectCast(e.Item, GridEditableItem)
' hard coded location
rntbQty = CType(geItem.Cells(1).FindControl("rntbQty"), RadNumericTextBox)
rntbQty.Focus()
End If
cast the e.item, go to the appropriate cells to find the LinkButton and the other control, then set the Text property of the button
in the ItemDataBound event handler of the grid
make sure it's the edit item
Dim rntbQty As RadNumericTextBox
If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
geItem = DirectCast(e.Item, GridEditableItem)
' hard coded location
rntbQty = CType(geItem.Cells(1).FindControl("rntbQty"), RadNumericTextBox)
rntbQty.Focus()
End If
cast the e.item, go to the appropriate cells to find the LinkButton and the other control, then set the Text property of the button
0
Accepted

Shinu
Top achievements
Rank 2
answered on 14 Nov 2012, 05:49 AM
Hi,
Try the following code to achieve your scenario.
C#:
Thanks,
Shinu.
Try the following code to achieve your scenario.
C#:
protected
void
RadGrid2_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem && e.Item.OwnerTableView.Name ==
"DetailTable1"
)
{
GridDataItem dataitem = (GridDataItem)e.Item;
if
(dataitem[
"UniqueName"
].Text ==
"text"
)
{
LinkButton link = (LinkButton)dataitem[
"EditColumn"
].Controls[0];
link.Text =
"some text"
;
}
}
}
Thanks,
Shinu.
0

Elliott
Top achievements
Rank 2
answered on 14 Nov 2012, 11:43 AM
Sam - pay no attention to my snippet
Shinu (again!) has corrected my code
thanks
Shinu (again!) has corrected my code
thanks
0

TechSavvySam
Top achievements
Rank 1
answered on 14 Nov 2012, 03:42 PM
Thanks Shinu,
You got me close enough that I was able to tweak it for my environment.
You got me close enough that I was able to tweak it for my environment.