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

Inserting new rows into the radgridview

5 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Somnath
Top achievements
Rank 1
Somnath asked on 20 Mar 2012, 07:36 AM
Hi,

I want to insert new rows into the radgrid, so that I can bind all the inserted rows finally and show the result into another radgrid below.

I want to implement functionality exactly as "Edit Query in TFS(Team foundation Server)". The inserted rows will always be in edit mode and when I click on some button, the final query will build and the result will be displayed into another grid view.

So please help.

Regards,
Ankit

5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 23 Mar 2012, 11:22 AM
Hello Ankit,

So you have a couple of grid. The first one contains the query options and the second the result from the query. Each query option is a row in the first grid.
What you need to do is:

1. Keep all the items in the first grid in edit mode as described below:
http://www.telerik.com/help/aspnet-ajax/grid-put-all-items-in-edit-mode-no-additional-rebind.html

2. Set the first grid's EditMode to InPlace.

3. Expose an UpdateAll button in the grid and perform batch updates through it as shown below:
http://www.telerik.com/help/aspnet-ajax/grid-performing-batch-updates.html

4. Intecept the ItemCommand event of the first grid and check for the UpdateAll command.

5. If this is the command being thrown, call the second's grid Rebind() method.

6. The second grid should be databound through the NeedDataSource event wherein the necessary calculations, made on the basis of the first grid's update data source and the second grid's business logic, should be performed.

Hope it helps.

All the best,
Tsvetoslav
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.
0
Somnath
Top achievements
Rank 1
answered on 23 Mar 2012, 01:39 PM
Hello Tsvetoslav,

Actually I didn't find the solution to add the rows in edit mode. I have used InPlace enabled, but there should be some mistakes from me, so I've to check it.

Thanks for your reply. I will follow your mentioned steps and let you know.

Thanks,
 Ankit

0
Somnath
Top achievements
Rank 1
answered on 26 Mar 2012, 11:01 AM
Hi,

I want to add the row on the change in current row selected item i.e on load there will be one row in grid in edit mode having dropdown controls in each column with no record selected.

So when I will select the record from 2nd row's drop down control, a new blank row will add below. 
Column names are same as TFS(Team Foundation Server) edit query's columns.
How could we do that?

Thanks,
Ankit
0
Tsvetoslav
Telerik team
answered on 28 Mar 2012, 03:21 PM
Hello Ankit,

You need to set AutopostBack=true for the last drop down control in the InsertForm. On post back from that control trigger and insert command for the grid, persist the new record in the data source which the grid is bound to and keep the inser form open. You also need to set the following two properties:
RadGrid1.MasterTableView.InsertItemDisplay = GridInsertItemDisplay.Bottom
RadGrid1.AllowPaging = false;


Regards, Tsvetoslav
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.
0
Somnath
Top achievements
Rank 1
answered on 05 Apr 2012, 10:30 AM
Hi,

Can you please tell me, how to append a string containing conditions to the where clause in LINQ?
In my code following, how could I add that WhereStr in LINQ's Where condition?

string WhereStr = string.Empty;           
WhereStr = bindWhere();    //bindWhere() function returns string of conditions. like "id=123 && Date =2/2/2012"
var query = from r in lstMapFiles
       //.Where()                
       select new
       {
       r.Id
       r.Date
       };
Tags
General Discussions
Asked by
Somnath
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Somnath
Top achievements
Rank 1
Share this question
or