This is a migrated thread and some comments may be shown as answers.

RadGrid not Firing Edit Event

4 Answers 161 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Maher
Top achievements
Rank 1
Maher asked on 02 Feb 2010, 01:13 PM

Could some one tell me why the code shown below is not firing the Edit Events when I click on the Edit Column, However, it fires when I click on the auto generated Edit column?


<telerik:RadGrid ID="dgRadERs" runat="server" AutoGenerateColumns="False" GridLines="None"
                    Skin="Sunset" AllowFilteringByColumn="True" OnEditCommand="dgRadERs_EditCommand"
                    AutoGenerateEditColumn="True" OnNeedDataSource="dgRadERs_NeedDataSource">
                    <MasterTableView EditMode="InPlace" DataKeyNames="ACCOUNT_NUMBER" AllowMultiColumnSorting="True"
                        Width="100%">
                        <Columns>
                            <telerik:GridBoundColumn DataField="account_number" HeaderText="Account Number" UniqueName="column1">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="account_name" HeaderText="Account Name" UniqueName="column">
                            </telerik:GridBoundColumn>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton">
                            </telerik:GridEditCommandColumn>
                        </Columns>
                        <RowIndicatorColumn Visible="True">
                        </RowIndicatorColumn>
                        <EditFormSettings>
                            <EditColumn UniqueName="EditCommandColumn1">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                </telerik:RadGrid>

Thank you
Maher

4 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 04 Feb 2010, 07:51 AM
Hello Maher,

I tried the code below that is based on your scenario but both the auto-generated and the declarative edit columns performed as expected:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
        Skin="Sunset" AllowFilteringByColumn="True" OnEditCommand="RadGrid1_EditCommand"
        AutoGenerateEditColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView EditMode="InPlace" DataKeyNames="account_number" AllowMultiColumnSorting="True"
            Width="100%">
            <Columns>
                <telerik:GridBoundColumn DataField="account_number" HeaderText="Account Number" UniqueName="column1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="account_name" HeaderText="Account Name" UniqueName="column">
                </telerik:GridBoundColumn>
                <telerik:GridEditCommandColumn ButtonType="ImageButton">
                </telerik:GridEditCommandColumn>
            </Columns>
            <RowIndicatorColumn Visible="True">
            </RowIndicatorColumn>
            <EditFormSettings>
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
</telerik:RadGrid>

Code behind:

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        DataTable Table = new DataTable();
        Table.Columns.Add("account_number");
        Table.Columns.Add("account_name");
        for (int i = 0; i < 5; i++)
        {
            Table.Rows.Add(i, i+i);
        }
        RadGrid1.DataSource = Table;
    }
    protected void RadGrid1_EditCommand(object source, GridCommandEventArgs e)
    {
 
    }


I hope this helps,
Martin
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Maher
Top achievements
Rank 1
answered on 04 Feb 2010, 01:27 PM
Thank you very much

Maher
0
Sunny
Top achievements
Rank 1
answered on 18 Jun 2012, 06:34 PM
Can someone please explain what's the purpose of OnEditCommand event ?

The msdn article below uses to set the EditItemIndex property of the grid to item being selected. But the Radgrid doesn't have this property?

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.templatecolumn.edititemtemplate%28v=vs.71%29.aspx


thanks,

Sunny
0
BabaYa
Top achievements
Rank 1
answered on 21 Jun 2012, 10:57 AM
Hi

Fired when the Edit button is clicked for an item in the RadGrid control.


http://www.telerik.com/help/aspnet-ajax/grid-getting-familiar-with-server-side-api.html

Tanks
BabaYa
Tags
Grid
Asked by
Maher
Top achievements
Rank 1
Answers by
Martin
Telerik team
Maher
Top achievements
Rank 1
Sunny
Top achievements
Rank 1
BabaYa
Top achievements
Rank 1
Share this question
or