This is a migrated thread and some comments may be shown as answers.
Adding rows in RadGrid at runtime
6 Answers 46 Views
This is a migrated thread and some comments may be shown as answers.
Robert Jakech
Top achievements
Rank 1
Robert Jakech asked on 21 Jan 2011, 01:31 PM
I have a radgrid through which i insert,update and delete data.

Within the radgrid, i have other controls such as textboxes, dropdowns etc
However, my biggest challenge is adding the rows from the client side.

Can someone help me with a code snippet where after entering the last data in a row and press TAB/ENTER or any other key on the keyboard, then a row within the radgrid is created.
My RadGrid looks like the code below:
 
                    
<telerik:RadGrid ID="newModulesGrid" runat="server" EnableAJAX="True" Width="85%"<br>                        EnableAJAXLoadingTemplate="true" RadControlsDir="~/Resources/RadControls/" Skin="Web20"<br>                        SkinsPath="~/Resources/RadControls/Grid/Skins" AutoGenerateColumns="False"><br>                        <MasterTableView><br>                            <Columns><br>                                <telerik:GridTemplateColumn HeaderText="Topic Code" UniqueName="topicCode" AllowFiltering="false"><br>                                    <ItemTemplate><br>                                        <telerik:RadTextBox ID="topicCodeTxt" runat="server" Width="75"><br>                                        </telerik:RadTextBox><br>                                    </ItemTemplate><br>                                </telerik:GridTemplateColumn><br>                                <telerik:GridTemplateColumn UniqueName="topicName" HeaderText="Topic Name" AllowFiltering="false"><br>                                    <ItemTemplate><br>                                        <telerik:RadTextBox ID="topicNameTxt" runat="server" Width="550"><br>                                        </telerik:RadTextBox><br>                                    </ItemTemplate><br>                                </telerik:GridTemplateColumn><br>                                <telerik:GridTemplateColumn Visible="false" HeaderText="Is Active" AllowFiltering="false"><br>                                    <ItemTemplate><br>                                        <asp:Label ID="addRowLabel" Visible="false" runat="server" Text='<%#Bind("AddRow") %>'></asp:Label><br>                                    </ItemTemplate><br>                                </telerik:GridTemplateColumn><br>                            </Columns><br>                        </MasterTableView><br>                    </telerik:RadGrid><br>                    <asp:ImageButton ID="saveButton" runat="server" OnClick="Save_New" ImageUrl="~/Resources/Buttons/SaveButton.jpg" /><br>  

6 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 21 Jan 2011, 05:06 PM
Hello Robert,

Note that RadGrid is by design bound control. The ASP.NET platform does not allow editing a database with JavaScript on the client. Therefore the RadGrid could not be updated only on the client without hitting the server as this does not make any sense. Adding a row only on the client-side without a hit on the server is kind of html injection and it does not correspond with the RadGrid main functionality. The new added rows will not be able to handle the main grid functionalities like sorting, paging, filtering etc. 



Kind regards,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Robert Jakech
Top achievements
Rank 1
answered on 21 Jan 2011, 05:25 PM
Hi Maria,
Imagine a scenario where you want to have 'excel like' Radgrid to insert data into the database.

How you would you do that?

thanks
0
Maria Ilieva
Telerik team
answered on 24 Jan 2011, 04:45 PM
Hello Robert,

Please revise the following code library which elaborates on this matter.

Best wishes,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Maria Ilieva
Telerik team
answered on 24 Jan 2011, 04:45 PM
Hello Robert,

Please revise the following code library which elaborates on this matter.

Best wishes,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Walid
Top achievements
Rank 1
answered on 08 May 2013, 12:45 PM
Dear Sir,

Is there any control like a data list or grid which is not bind able, i need a container holding some controls(text boxes, combo...etc) and adding rows to it manually without binding with a data source in order to not lose user data entered in the previous rows.
0
Maria Ilieva
Telerik team
answered on 09 May 2013, 12:18 PM
Hi Walid,

Please review the answer provided in the other thread you have opened with the same question.

Regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Robert Jakech
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Robert Jakech
Top achievements
Rank 1
Walid
Top achievements
Rank 1
Share this question
or