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

GridEditCommandColumn update function

1 Answer 286 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sharon
Top achievements
Rank 1
Sharon asked on 24 Mar 2014, 06:48 PM
Hi,

I'm new to telerik products and fairly new to ASP.net AJAX.  I have a panel that displays textbook information and allows the user to Edit or Delete a book from the list.  When the user selects Edit, the window for that record expands and the user can change the status of the book.  They then hit either Update or Cancel.  When the user hits Update, it saves the new status and the display goes back to the form before the user hit Edit.

What I want to do is perform additional updates on other tables when the user updates the status.  I need to know how I can set the panel to perform the additional updates - the updates are different for the different statuses.

Thanks in advance,
Sharon

​ <asp:Panel runat="server" ID="pnlBooks" Visible="false">
<telerik:RadGrid ID="rgBooks" runat="server"
AllowFilteringByColumn="True"
AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False"
PageSize="20"
DataSourceID="ldsBooks"
AllowAutomaticUpdates="true"
AllowAutomaticDeletes="false"
>
<MasterTableView ShowFooter="False" DataKeyNames="barcode" ClientDataKeyNames="barcode"
DataSourceID="ldsBooks" EditMode="EditForms" HeaderStyle-Font-Bold="true">
<Columns>
<telerik:GridBoundColumn DataField="barcode" HeaderText="Barcode" UniqueName="barcode" ReadOnly="true" Visible="true" />
<telerik:GridBoundColumn DataField="tbtCatalog.isbn" HeaderText="ISBN" UniqueName="isbn" ReadOnly="true" Visible="true" />
<telerik:GridBoundColumn DataField="entityID" HeaderText="School" UniqueName="entityID" ReadOnly="true" Visible="false" />
<telerik:GridDropDownColumn DataField="entityID" DataSourceID="ldsSchools"
HeaderText="School" ListTextField="SCHABBRV" ListValueField="SchoolNum"
ReadOnly="true" SortExpression="INFO_SCH.SCHABBRV" UniqueName="SchAbbrv"
Visible="true">
</telerik:GridDropDownColumn>
<telerik:GridBoundColumn DataField="room" HeaderText="Room/Dept" UniqueName="room" ReadOnly="true" Visible="true" />
<telerik:GridBoundColumn DataField="tbtCatalog.Title" HeaderText="Title" UniqueName="title" ReadOnly="true" Visible="true" />
<telerik:GridBoundColumn DataField="tbtStatus.StatusName" HeaderText="Current Status" UniqueName="StatusName" ReadOnly="true" Visible="true" />
<telerik:GridBoundColumn DataField="StatusCode" UniqueName="StatusCode" ReadOnly="true" Visible="false" />
<telerik:GridDropDownColumn DataField="StatusCode" DataSourceID="ldsStatus"
HeaderText="Status" ListTextField="StatusName" ListValueField="StatusID"
ReadOnly="false" SortExpression="tbtStatus.StatusName" UniqueName="StatusID"
Visible="false" >
</telerik:GridDropDownColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" />
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete" ConfirmText="Are you sure you want to delete this book?" ></telerik:GridButtonColumn>

</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Panel>

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 27 Mar 2014, 01:07 PM
Hi Sharon,

You could simply cancel the UpdateCommand and perform the additional logic you need like this;
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.UpdateCommandName)
        {
            e.Canceled = true;
            //your additional logic here
        }
    }

I hope this helps.

Regards,
Maria Ilieva
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Sharon
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or