简体   繁体   中英

Disable Telerik radgrid EditMode

I listen to the EditCommand-event of my radgrid and open my own popup to let the user edit the dataset selected. But the radgrid opens his own edit form everytime too. Is there a way to disable the radgrids edit form completely?

User RadGrid_Prerender:- PreRender is called before the control is rendered for the page.

ASPX:-

protected void RadGrid1_PreRender(object sender, EventArgs e) 
{ 

    foreach( GridDataItem item in RadGrid1.MasterTableView.Items ) 
    { 
        LinkButton btnEdit = (LinkButton)item.FindControl("columnEdit"); 
        btnEdit.Enabled = false; 
    } 

} 

Hope Its Work !!

Happy Coding !!

I was able to find a solution for this problem by myself. My column which contains the LinkButton to open the edit popup is defined like this:

GridColumn gbcEdit = defineGridButtonColumn("[image_url]", "Edit", "editRow");

Then I register an event to the radgrid.ItemCommand:

this.radgrid.ItemCommand += radgrid_ItemCommand;

In this event I check whether the command is "editRow" or not. Notice that if you write only "edit" as the command, the radgrid will open its own edit mode template everytime.

private void radgrid_ItemCommand(object sender, GridCommandEventArgs e)
{
     if (e.CommandName == "editRow")
          //Show own edit popup;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM