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

Update in grid

3 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 16 Apr 2013, 10:11 AM
Hello,
I am new to RadGrid, i want to achive bellow mentioned functinality in RAD grid.
1. Bind a datatable to RadGrid and populate it on button click,
2.  Afer grid is get populated if user dubble click on specific row then that row should be editable and as soon as user clicks on any other row or any other control on the screen then the data modified in current selected row should get updated (it should update the dattable which is assosiated to Rad Grid).

this functinality is currently done using some different third party Grid i want to replace that grid with Rad Grid, please let me know whether is it possible in Rad Grid and how to do it.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Apr 2013, 10:18 AM
Hi,

Try the following code to achieve your scenario.
C#:
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
        SqlConnection con1 = new SqlConnection(WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
        SqlCommand cmd = new SqlCommand("SELECT top 10 * FROM [Orders]", con1);
        SqlDataAdapter ad = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        ad.Fill(ds);
        RadGrid1.DataSource = ds;
}
protected void Button1_Click(object sender, EventArgs e)
{
        RadGrid1.Visible = true;
}

JS:
function RowDblClick(sender, eventArgs) {
      editedRow = eventArgs.get_itemIndexHierarchical();//putting the row in edit mode on double click
      $find("<%= RadGrid1.ClientID %>").get_masterTableView().editItem(editedRow);
  }

Also check the following demo.
Grid - Edit on Double-click

Thanks,
Shinu
0
Rahul
Top achievements
Rank 1
answered on 04 Jun 2013, 06:11 AM
Hello,
 I have implemented the same code which you have mentioned and it is allowing user to edit the details on double click on specific row but after user click on any other row it is not calling any server side event RadGrid1_ItemUpdated. Please let me know how will it call the server side event as soon as any row is updated. so that on row update I will implement the logic to update the data table and finally on save button I will update the data table to database at once. in short I have to implement bellow functionality
1. There will be a data in data table I want to bind that data table to Rad Grid
2.  User will double click on any row and that row will become editable. user will edit as many rows as he want to edit.
3. After each row edited by the user we will update the Data table which we have bind to rad grid initially.

Request you to please guide me that how can we implement the functionality so that as soon as he update any row it should call the Server side event. so that I will get the updated details and update it to data table.


0
Princy
Top achievements
Rank 2
answered on 04 Jun 2013, 06:36 AM
Hi Rahul,

Please try the update in UpdateCommand of the radgrid.

Thanks,
Princy
Tags
Grid
Asked by
Rahul
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rahul
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or