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

[Solved] Unable to get the grid event in the codebehind.

5 Answers 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suresh Krishna
Top achievements
Rank 1
Suresh Krishna asked on 01 Mar 2010, 09:36 AM

On click of “Add new item”  the template is shown with Insert and Cancel button.But on click of insert I am not getting the event on the codebehind.

It’s the same on edit……when I click “Update" button.

I have pasted the code here.


 

 <telerik:RadGrid id="RadGrid1" runat="server" Skin="Office2007"  Width="40%"

                            AllowSorting="true" AllowMultiRowSelection="true" AllowMultiRowEdit="true"

                            AutoGenerateColumns="False">

                            <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="ID">

                                <CommandItemTemplate>

                                    <table>

                                        <tr>

                                            <td width="30%">

                                                <asp:LinkButton ID="btnAdd" Text="Add new item" CommandName="InitInsert" runat="server"></asp:LinkButton>

                                                <asp:LinkButton ID="btnEdit" Text="Edit selected" CommandName="EditSelected" runat="server"></asp:LinkButton>

                                            </td>

                                            <td width="40%">

                                            </td>

                                            <td width="30%">

                                                <asp:LinkButton ID="btnRefresh" Text="Refresh data" CommandName="Rebind" runat="server"></asp:LinkButton>

                                                <asp:LinkButton ID="btnUpdate" Text="Update edited" CommandName="UpdateEdited" runat="server"></asp:LinkButton>

                                            </td>

                                        </tr>

                                    </table>

                                </CommandItemTemplate>

                                <Columns>

                                 <telerik:GridEditCommandColumn ButtonType="ImageButton">

                                 </telerik:GridEditCommandColumn>

                                    <telerik:GridBoundColumn DataField=" ID" HeaderText="ID" SortExpression="TR_ID"

                                        Visible="false" UniqueName="ID">

                                    </telerik:GridBoundColumn>

                                    <telerik:GridBoundColumn DataField="Customer" FilterControlWidth="40px" HeaderText="Customer"

                                        SortExpression="Customer" UniqueName="Customer">

                                    </telerik:GridBoundColumn>

                                    <telerik:GridBoundColumn DataField="ProjectNumber" FilterControlWidth="40px" HeaderText="Project Number"

                                        SortExpression="ProjectNumber" UniqueName="ProjectNumber">

                                    </telerik:GridBoundColumn>

                                    <telerik:GridBoundColumn DataField="TestNumber" FilterControlWidth="40px" HeaderText="Test Number"

                                        SortExpression="TestNumber" UniqueName="TestNumber">

                                    </telerik:GridBoundColumn>

                                </Columns>

                                <EditFormSettings EditFormType="Template">

                                    <FormTemplate>

                                        <table id="Table2" cellspacing="2" cellpadding="1" width="900px" border="1" rules="none"

                                            style="border-collapse: collapse; background: white;">

                                            <tr>

                                                <td style="width: 50%">

                                                    <table width="100%">

                                                        <tr>

                                                            <td colspan="2">

                                                                <asp:Label ID="Label1" CssClass="tableheading" runat="server" Text="Test Info :"

                                                                    Font-Bold="True"></asp:Label>

                                                            </td>

                                                        </tr>

                                                        <tr>

                                                            <td style="width: 30%">

                                                                <asp:Label ID="Label3" CssClass="data" runat="server" Text="Run No"></asp:Label>

                                                            </td>

                                                            <td>

                                                                <telerik:RadTextBox ID="RadTextBox11" Text='<%# Bind( "Customer" ) %>' runat="server"

                                                                    CssClass="data">

                                                                </telerik:RadTextBox>

                                                            </td>

                                                        </tr>

                                                        <tr>

                                                            <td style="width: 30%">

                                                                <asp:Label ID="Label4" CssClass="data" runat="server" Text="Bucket Type"></asp:Label>

                                                            </td>

                                                            <td>

                                                                <telerik:RadTextBox ID="RadTextBox12" Text='<%# Bind( "ProjectNumber" ) %>' runat="server"

                                                                    CssClass="data">

                                                                </telerik:RadTextBox>

                                                            </td>

                                                        </tr>

                                                    </table>

                                                </td>

                                                <td>

                                                    <table>

                                                        <tr>

                                                            <td colspan="2">

                                                                <asp:Label ID="Label31" CssClass="tableheading" runat="server" Text=""></asp:Label>

                                                            </td>

                                                        </tr>

                                                           <tr>

                                                            <td style="width: 30%">

                                                                <asp:Label ID="Label2" CssClass="tableheading" runat="server" Text="Name"></asp:Label>

                                                            </td>

                                                            <td style="width: 70%">

                                                                <telerik:RadComboBox ID="ddldrp" Width="100%" runat="server"  >                                                               </telerik:RadComboBox>

                                                            </td>

                                                        </tr>

                                                        <tr>

                                                            <td style="width: 30%">

                                                                <asp:Label ID="Label5" CssClass="data" runat="server" Text="TestNumber"></asp:Label>

                                                            </td>

                                                            <td>

                                                                <telerik:RadTextBox ID="RadTextBox13" Text='<%# Bind( "TestNumber" ) %>' runat="server"

                                                                    CssClass="data">

                                                                </telerik:RadTextBox>

                                                            </td>

                                                        </tr>

                                                    </table>

                                                </td>

                                            </tr>

                                            <tr>

                                                <td align="right" colspan="2">

                                                    <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'

                                                        runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>

                                                    </asp:Button>&nbsp;

                                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"

                                                        CommandName="Cancel"></asp:Button>

                                                </td>

                                            </tr>

                                        </table>

                                    </FormTemplate>

<EditColumn UniqueName="EditCommandColumn1"></EditColumn>

 

                                    <FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle>

                                    <FormCaptionStyle></FormCaptionStyle>

                                </EditFormSettings>

                            </MasterTableView>

                            <ClientSettings>

                                <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />

                            </ClientSettings>

                        </telerik:RadGrid>

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 01 Mar 2010, 05:35 PM
Hello Suresh,

Please, refer to the following online resources for more information about inserting new data, updating existing data and deleting data in the RadGrid control directly from the specified data source:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grdautomaticdatasourceoperations.html

All the best,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Suresh Krishna
Top achievements
Rank 1
answered on 02 Mar 2010, 11:33 AM

The example which u have shown dint help me much,I was able to do it in that way.

But here i have used FormTemplate for Edit with two buttons(update and Cancel),On click of these button i am not able to get the event on the code-behind.

0
Pavlina
Telerik team
answered on 02 Mar 2010, 01:26 PM
Hello Suresh,

I suggest you examine the following online resources and let me know if further assistance is needed:
Custom edit forms
Form Template Edit Form
Updating values using UserControl/FormTemplate

Greetings,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Suresh Krishna
Top achievements
Rank 1
answered on 03 Mar 2010, 09:38 AM
HI

I tried that to.But still the same result..
What could be the reasons, due to which i am not able to get the events on code behind.
Is there anything which i need to take care specifically ?

0
Pavlina
Telerik team
answered on 03 Mar 2010, 11:46 AM
Hello Suresh,

Based on this information, it is very hard to pinpoint the cause of the problem. If the issue persists, you can open a formal support ticket, and send us a small implementation, demonstrating the setup and hand, and the unwanted behavior. We will review it locally, and get back to you with additional information.

Regards,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Suresh Krishna
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Suresh Krishna
Top achievements
Rank 1
Share this question
or