4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 13 Jun 2011, 11:58 AM
Hello Mohammed,
I suppose you want to access GridButtonColumn and check for its CommandName in ItemCreated. If that is the requirement, here is the code that I tried. Hope this helps.
aspx:
C#:
Thanks,
Princy.
I suppose you want to access GridButtonColumn and check for its CommandName in ItemCreated. If that is the requirement, here is the code that I tried. Hope this helps.
aspx:
<telerik:GridButtonColumn CommandName="Delete" UniqueName="delete"></telerik:GridButtonColumn>C#:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e){ if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; LinkButton btn = (LinkButton)item["delete"].Controls[0]; if (btn.CommandName == "Delete") { //your code here } }
}Thanks,
Princy.
0
mohamed
Top achievements
Rank 1
answered on 13 Jun 2011, 12:04 PM
Thanks replay princy
How to fine boundcolumn in that commandname .
What i Click that id only come but grid bound last id is come
please replay soon
GridDataItem item1 = (GridDataItem)e.Item;
TableCell txtb = item1["AssetID"];
TextBox txt = (TextBox)txtb.Controls[0];
bold one error get like that Specified argument was out of the range of valid values.Parameter name: index
Thanks,
Mohamed.
How to fine boundcolumn in that commandname .
What i Click that id only come but grid bound last id is come
please replay soon
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; TableCell cell = item["DeleteColumn"]; ImageButton btn = (ImageButton)cell.Controls[0]; //NOT RECOMMENDED if (btn.CommandName == "Delete") {TableCell txtb = item1["AssetID"];
TextBox txt = (TextBox)txtb.Controls[0];
} } }Thanks,
Mohamed.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 13 Jun 2011, 07:27 PM
Hi,
Thanks,
Jayesh Goyani
if (btn.CommandName == "Delete") { GridDataItem item1 = (GridDataItem)e.Item; String strTemp = ((TextBox)item1["BoundColumnUniqueName"].Controls[0]).Text; //if above line gives error related to index then use "Controls[1]" }Thanks,
Jayesh Goyani
0
mohamed
Top achievements
Rank 1
answered on 14 Jun 2011, 04:22 AM
hi Jayesh Goyani
now also same problem come
Thanks,
Mohamed.
now also same problem come
Thanks,
Mohamed.