Problem:
I am using GridTemplateColumn in RadGrid and I want find the label control which is in grid's ItemTemplate to update record.I am using this code in grid's updatecommand,
VB CODE:
Dim Label1 As Label = CType(e.Item.FindControl("Label1"), Label)
but control is not found thus there is (nothing) in Label1.
Solution:
Try this,VB CODE:
Dim Label1 As Label = DirectCast(CType(e.Item, GridEditFormItem).OwnerTableView.Items(e.Item.ItemIndex).FindControl("Label1"), Label)
protected void idItemName_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
ReplyDelete{
if ((e.Item.ItemType == Telerik.Web.UI.GridItemType.Item) || (e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem))
{
GridDataItem dataItem = (GridDataItem)e.Item;
RadButton btnEdit = (RadButton)dataItem["USurveyAction"].Controls[0];
}
}
Then you use that btnEdit anywhere.
BtynEdit.text="Any new Value";
thank u kumar and ashar
ReplyDelete