Currently I have a grid with multiple rows. The last column of the grid is an imagebutton inside a GridTemplateColumn to "remove" the row. What i mean by remove is actually change the value of another column in a GridBoundColumn and hide the desired row.
I currently have an itemcommand and commandname on the imagebutton.
The grid itself has the OnItemCommand event bound.
Have a GridTemplateColumn to hold the "ActionID"
and finally have the function in the code-behind:
How can I get this to set the actionID so it can be rebound?
I currently have an itemcommand and commandname on the imagebutton.
<
asp:ImageButton
runat
=
"server"
ID
=
"imgRemoveCostCenter"
ImageUrl
=
"~/Images/Remove.png"
OnItemCommand
=
"rad_CostCenters_ItemCommand"
CommandName
=
"HideCostCenter"
/>
The grid itself has the OnItemCommand event bound.
<
telerik:RadGrid
ID
=
"rad_CostCenters"
OnItemCommand
=
"rad_CostCenters_ItemCommand"
AllowMultiRowEdit
=
"true"
AutoGenerateColumns
=
"false"
EnableTheming
=
"true"
Skin
=
"Default"
AllowSorting
=
"false"
runat
=
"server"
ShowHeader
=
"true"
OnItemDataBound
=
"Rad_ManagersList_ItemDataBound"
>
Have a GridTemplateColumn to hold the "ActionID"
<
telerik:GridBoundColumn
UniqueName
=
"ActionID"
DataField
=
"ActionID"
Visible
=
"false"
/>
and finally have the function in the code-behind:
protected void rad_CostCenters_ItemCommand(object sender, GridCommandEventArgs e)
{
GridDataItem item = (GridDataItem)e.Item;
int _ActionID = Convert.ToInt16(item["ActionID"].Text);
if (e.CommandName == "HideCostCenter")
{
_ActionID = -1;
}
rad_CostCenters.Rebind();
}
protected void Rad_ManagersList_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DataRowView drv = (DataRowView)e.Item.DataItem;
int _ActionID = Convert.ToInt16(item["ActionID"].Text);
if (_ActionID == -1)
{ item.Display = false; }
}
}
How can I get this to set the actionID so it can be rebound?