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

Edit,Update RadGridView

7 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kaushal
Top achievements
Rank 1
Kaushal asked on 02 Nov 2010, 06:13 AM
Hello ALL,

              I have Rad Grid on page, now i need to apply inline edit functionality for grid,can you please suggest me how can i achieve edit/update functionality for grid?

Thanks
Kaushal

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Nov 2010, 07:16 AM

Hello Kaushal,

To display the grid column editors inline when the grid switches into edit mode, change the table view's EditMode property to "InPlace".

ASPX:

   <telerik:RadGrid ID="RadGrid1" runat="server" ....>  
          <MasterTableView EditMode="InPlace">

 

Telerik RadGrid provides rich server API for inserting new data, updating existing data and deleting data directly from the specified data source (AccessDataSource, SqlDataSource or ObjectDataSource) without additional code. Keep in mind that you will have to configure the respective data source control (including update/insert/delete parameters to its definition) to trigger the automatic operations.

Check the following links to know more:
Demo
Documentation


Thanks,
Princy.

0
Kaushal
Top achievements
Rank 1
answered on 02 Nov 2010, 08:51 AM
Thanks Princy

          I did the same as editmode="InPlace" but still when i click on edit link i coudn't find edit template or edited textbox.

0
Princy
Top achievements
Rank 2
answered on 02 Nov 2010, 02:01 PM
Hello Kaushal,
Can you please paste your code .
Thanks,
 Princy.
0
Kaushal
Top achievements
Rank 1
answered on 03 Nov 2010, 08:06 AM
Hi Princy ,

Please refer my code

.aspx

  <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
                                    ShowGroupPanel="True" Width="100%" AllowPaging="True" AllowSorting="True" AllowMultiRowSelection="True"
                                    Height="100%" Skin="Vista" OnItemUpdated="RadGrid1_ItemUpdated" EnableViewState="false">
                                    <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True"
                                        AllowKeyboardNavigation="True">
                                        <Selecting AllowRowSelect="True" />
                                        <ClientEvents OnGridCreated="ResizeEvent" />
                                        <Scrolling AllowScroll="True" UseStaticHeaders="True" FrozenColumnsCount="3" />
                                        <Resizing ResizeGridOnColumnResize="True" AllowColumnResize="True" />
                                    </ClientSettings>
                                    <MasterTableView EditMode="InPlace" TableLayout="Fixed" Width="100%" GridLines="Both" AllowAutomaticUpdates="True"
                                        AutoGenerateColumns="False">
                                        <ExpandCollapseColumn>
                                            <HeaderStyle Width="20px" />
                                        </ExpandCollapseColumn>
                                        <EditFormSettings ColumnNumber="3">
                                            <EditColumn ButtonType="PushButton">
                                            </EditColumn>
                                        </EditFormSettings>
                                        <PagerStyle AlwaysVisible="True" />
                                        <HeaderStyle Wrap="False" />
                                    </MasterTableView>
                                </telerik:RadGrid>

I have create class to bind grid , on same i have create object of RadGrid and perform all funcitons and methods overthere, now what problem occurs when i try to click on edit image grid get closed and after that if suppose its rebind than i got edit form for edited record.i am confuse that why grid get disappear when i click on edit image.

Please help me.

Thanks
Kaushal
0
Vasil
Telerik team
answered on 03 Nov 2010, 12:27 PM
Hello Kaushal,

The grid disappears, because you do make postback and the grid rebinds. If you want to go in edit mode, without making postbacks, please see the below demos:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/clienteditbatchupdates/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/client/insertupdatedelete/defaultcs.aspx

And for more information refer to the additional links, that are provided in the description of the demos.

Regards,
Vasil
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
Kaushal
Top achievements
Rank 1
answered on 03 Nov 2010, 01:00 PM
Thanks Vasil,

                    You are right, but i have one demo page on which i have two Rad Grid, One grid direct bind using sqldatasource and one grid bind from my class method which will return array of data, now both grid have same property like AutoGenerateEdit button and many more, but when i click on edit button of first grid which is binded using sqldatasource working properly but second grid which is bind using array of data from class file get disappear when i try to click on edit button, really i feel its strange and couldn't find the exact problem with this.can you please help me for same.

Method for Second Grid

    var FieldList := new Fields[100];
    FieldList := objClass.GetUserFields();
    RadGrid2.DataSource := FieldList;
    RadGrid2.DataBind();

Thanks
Kaushal
0
Vasil
Telerik team
answered on 03 Nov 2010, 03:52 PM
Hello Kaushal,

If you bind the grid on Page_Load, do not use if (!IsPostBack) but bind it every time. Or you need to bind it when doing paging, editing, deleting, etc.

Another option is to use advanced data binding. Set OnNeedDataSource="RadGrid1_NeedDataSource" in the declaration your RadGrid2, and use this code-behind:

Protected Sub RadGrid1_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
      var FieldList = new Fields[100];
      FieldList = objClass.GetUserFields();
      RadGrid2.DataSource = FieldList;
End Sub

All the best,
Vasil
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
Kaushal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kaushal
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or