to delete..
following is the code
gbtc = new GridButtonColumn();
gbtc.HeaderText = "Delete";
gbtc.UniqueName = "ibtnDelete";
gbtc.ImageUrl = "~/App_Themes/Bari_Default/images/delete_ico.png";
gbtc.ButtonType = GridButtonColumnType.ImageButton;
gbtc.CommandName = "Delete";
gbtc.Visible = false;
gbtc.FilterImageToolTip = "";
rgdProcedureMaster.MasterTableView.Columns.Add(gbtc);
do i need to add more information for it to get done
5 Answers, 1 is accepted



I am not sure in which event you have created the columns. When creating RadGrid on Page_Load event, the columns or detail tables should be added to the corresponding collection first and then values for the properties of this instance should be set. Remember to check the condition (Not IsPostBack) to avoid adding the same structure objects to the grid twice. This is important because no ViewState is managed for the object before it has been added to the corresponding collection.
When generating a grid in the Page_Init event handler, grid columns should be added to the Columns collection of the MasterTableView after their attributes are set. No ViewState is required for grid structure to be persisted as it is recreated on each page initialization:
Thanks,
Shinu.

following code is the part of my application
front end:
<telerik:RadGrid ID="rgdProcedureMaster" runat="server" AllowPaging="True" GridLines="Vertical"
AutoGenerateColumns="False" EnableEmbeddedSkins="False" Skin="BariRC" AllowSorting="True"
AllowFilteringByColumn="True" PageSize="5" OnItemDataBound="rgdProcedureMaster_ItemDataBound"
CellSpacing="0" OnItemCommand="rgdProcedureMaster_ItemCommand" EnableViewState="true" DataSourcePersistenceMode="NoPersistence">
<GroupingSettings CaseSensitive="false" />
<SortingSettings EnableSkinSortStyles="false" />
<ClientSettings>
<ClientEvents OnFilterMenuShowing="FilterMenuShowing" />
</ClientSettings>
<MasterTableView DataKeyNames="Id" AllowNaturalSort="false" EnableColumnsViewState="false">
</MasterTableView>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_BariRC" EnableEmbeddedSkins="False">
</HeaderContextMenu>
</telerik:RadGrid>
code behind:
private void loadColumn(IList<BOL.Master.LookupReference> iList, string lookUpType)
{
gbtc = new GridButtonColumn();
gbtc.HeaderText = "Delete";
gbtc.UniqueName = "ibtnDelete";
gbtc.ImageUrl = "~/App_Themes/Bari_Default/images/delete_ico.png";
gbtc.ButtonType = GridButtonColumnType.ImageButton;
gbtc.CommandName = "Delete";
gbtc.Visible = false;
gbtc.ConfirmDialogType = GridConfirmDialogType.RadWindow;
gbtc.FilterImageToolTip = "";
rgdProcedureMaster.MasterTableView.Columns.Add(gbtc);
}
protected void rgdProcedureMaster_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "Page" || e.CommandName == "ChangePageSize" || e.CommandName == "Sort" || e.CommandName == "Filter")
{
LoadGridColumns();
ConfigForm();
LoadProcedureData();
}
else if (e.CommandName == "Delete")
{
GridDataItem item = (GridDataItem)e.Item;
string procedureIds = Convert.ToString(item.GetDataKeyValue("Id")) + ",";
Result result = BariAnalyticsEHR.BLL.Master.Management.Procedures.DeleteProcedures(procedureIds, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, LanguageCulture.EN_US);
if (result.Status)
{
loadColumn();
}}}
and i m calling this loadColumn() method in Bind() of the widget since i m using Dashboard.
i m able to load another page on clicking edit image button but when i click on delete image button,the grid disappears and i when i change page size of the grid the ItemCommand event is getting fired but its not getting fired for paging,sortong and for delete..

I guess you are populating RadGrid in PageLoad event. Bind your grid using advanced Data-binding(Using NeedDataSource event).
Please refer the following documentation
Advanced Data-binding (using NeedDataSource event)
-Shinu.