We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Update Gridview on single button click

Thread ID:

Created:

Updated:

Platform:

Replies:

82654 Jun 18,2009 09:53 AM UTC Oct 23,2013 09:10 AM UTC ASP.NET Web Forms (Classic) 4
loading
Tags: GridGroupingControl
Harshad Teli
Asked On June 18, 2009 09:53 AM UTC

I am using GridGrouping control , I set ExcelEditMode="True" ,i also have the checkbox column. Now what i want is after making changes in grid i clicked on Save button and that button will loop over that gridview and save updated record in database and refresh grid with updated values.I am using dataset to bind gridview.. please provide me code sample if possible.(see attached image)

Harshad Teli
Replied On June 18, 2009 10:30 AM UTC

I am using SQL Server2005 and VS2008

Rekha P [Syncfusion]
Replied On June 22, 2009 11:56 AM UTC

Hi Harsha,

Thank you for your interest in Syncfusion Products.

The Essential Grid provides support for Excel-like Edit for all editable fields. This feature offers cell in-line editing, cell selection and row selection. Please find a simple sample illustrtaing Excel Like Edit feature.

http://files.syncfusion.com/support/GGC.Web/7.2.0.37/F82654/Sample.zip

Features illustrated in above sample:
- GridGroupingControl is binded with SqlDataSource.
- ExcelEditMode is enabled with a column [Discontinued] with CheckBox.
- Updated values can be retrieved via Save button click and then updated into DataBase.
- Get the TableRow in the TopLevelTable.
- Check if that Row is GridRow if so Iterate the updated Records. Please refer the code snippet.

void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "";
foreach (TableRow row in this.GridGroupingControl1.TopLevelTable.Rows)
{
if (row is GridRow)
{
GridRow gridRow = row as GridRow;
if (gridRow.Record != null)
{
foreach (GridColumnDescriptor gcd in this.GridGroupingControl1.TableDescriptor.Columns)
{
Label1.Text += gridRow.Record.GetValue(gcd.Name) + "--";
}
Label1.Text += "
";

//Update the values into the database.

}
}
}
}


Please have a look at the above sample and let me know if this helps you out.

Thanks,
Rekha

Fernando
Replied On August 7, 2012 10:55 AM UTC

Hi! I am trying to accomplish this, the sample posted here is not available, can you send me a similar sample? Thanks!
 
Regards,
Fernando

Sandhya D [Syncfusion]
Replied On October 23, 2013 09:10 AM UTC

Hi Fernando,

Thanks for your interest in syncfusion products.

We have created a similar sample based on your requirement , Please refer the code below.

[Default.aspx.cs]:
public  void  button2_Click(object sender, EventArgs e)
{
Label1.Text = "";
foreach (TableRow row in this.GridGroupingControl1.TopLevelTable.Rows)
{
if (row is GridRow)
{
GridRow gridRow = row as GridRow;
if (gridRow.Record != null)
{
foreach (GridColumnDescriptor gcd in this.GridGroupingControl1.TableDescriptor.Columns)
{
Label1.Text += gridRow.Record.GetValue(gcd.Name) + "--";
}
Label1.Text += "";
//Update the values into the database.
}
}
}
}

[Default.aspx]:
<asp:Button ID="Button2" onClick="button2_click" runat="server" Text="Getdata" OnClientClick="update()"/>

We have attached sample for your reference.Please get back to us if you need further assistance.

Regards,
Sandhya D


LocalizeGrid_5e6fea31.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;