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

delete postback does not fire for only delete button.

3 Answers 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saro
Top achievements
Rank 1
Saro asked on 08 May 2012, 06:20 PM
I have a grid which I have delete , edit and addnew buttons. standard buttons nothing more.
The update works fine.  User clicks on it and then makes changes and presses standard grid on line edit check button and the codebehind fires.  When the user clicks on the delete button a row is immediatly deleted from the grid but no code behind is executed.  Now if I click on another control that forces a autopostback then all of a sudden the codebehind fires.  Do I need to set a property i am not aware of?

<Columns><telerik:GridEditCommandColumn ButtonType="ImageButton"
                                FilterControlAltText="Filter EditCommandColumn column"></telerik:GridEditCommandColumn><telerik:GridClientDeleteColumn ButtonType="ImageButton"
                                FilterControlAltText="Filter column1 column"
                                UniqueName="column1">
                                </telerik:GridClientDeleteColumn>
                                  <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="MMType">
                                    <ItemTemplate>
                                      <asp:Label ID="lblMMType" runat="server"><%# DataBinder.Eval(Container.DataItem, "MultiMediaLookupText")%>
                                      </asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                      <asp:DropDownList ID="MM_Dropdown" runat="server"  />
                                    </EditItemTemplate>
                                  </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="MultiMediaText" HeaderText="MultiMediaText" UniqueName="MultiMediaText" />
                                </Columns>

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 May 2012, 05:36 AM
Hello Saro,

GridClientDeleteColumn is designed to delete rows client-side. If you are using GridClientDeleteColumn you can handle DeleteCommand server-side as shown below.
C#:
protected void RadGrid1_DeleteCommand(object sender, GridCommandEventArgs e)
{//your code
}

Thanks,
Shinu.
0
Saro
Top achievements
Rank 1
answered on 09 May 2012, 11:35 AM
Shinu, I am aware.of that and I did do that. However, as I said in my original post it doesn't fire until a form refresh is done or another postback ( like after pressing another button) So to recap the code behind fires not after I press the delete but after I press another postback button. Thanks
0
Saro
Top achievements
Rank 1
answered on 10 May 2012, 11:33 PM
OK.  Got the solution:
http://www.telerik.com/community/forums/aspnet/grid/my-gridclientdeletecolumn-doesn-t-seem-to-cause-a-postback-why.aspx

>>
Hi guys,

GridClientDeleteColumn is designed to delete rows client-side and to persist these changes. Once you post your page to the server the grid will delete client deleted rows. If you want immediate delete with post-back you can use GridButtonColumn with CommandName = "Delete".

Greetings,
Vlad
the Telerik team
<<
Tags
Grid
Asked by
Saro
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Saro
Top achievements
Rank 1
Share this question
or