Inserting new rows into the radgridview

6 posts, 0 answers
  1. Somnath
    Somnath avatar
    43 posts
    Member since:
    Jun 2012

    Posted 20 Mar 2012 Link to this post

    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
  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 23 Mar 2012 Link to this post

    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.
  3. Somnath
    Somnath avatar
    43 posts
    Member since:
    Jun 2012

    Posted 23 Mar 2012 Link to this post

    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

  4. Somnath
    Somnath avatar
    43 posts
    Member since:
    Jun 2012

    Posted 26 Mar 2012 Link to this post

    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
  5. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 28 Mar 2012 Link to this post

    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.
  6. Somnath
    Somnath avatar
    43 posts
    Member since:
    Jun 2012

    Posted 05 Apr 2012 Link to this post

    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
           };
Back to Top