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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Updating inserted grid row with a newly assigned ID value

Thread ID:

Created:

Updated:

Platform:

Replies:

88192 Jul 16,2009 10:19 PM UTC Jul 21,2009 12:17 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
John Taylor
Asked On July 16, 2009 10:19 PM UTC


Given the following simple grid:



ConnectionString="<%$ ConnectionStrings:PrimaryDS %>"
SelectCommand="SELECT [DisplayText], [SortOrder], [CommodityGroupId] as Id FROM [CommodityGroups] ORDER BY [SortOrder], [DisplayText]"
InsertCommand="AddCommodityGroup" InsertCommandType="StoredProcedure">









What is necessary to get the value of the output parameter (Id) into the corresponding grid row?



Balaji M [Syncfusion]
Replied On July 21, 2009 12:17 PM UTC

Hi John,

Thank you for your interest in Syncfusion products.

We would suggest you to use the GridGroupingControl1.Table.CurrentRecord.SetValue method, in order to set the value to grid row (#ID value returned from output parameter).

Please find the updated sample from the below link.
http://files.syncfusion.com/support/GGC.Web/7.2.0.20/58127/sample1.zip

The Sample illustrates,

1. EmployeeID is ReadOnly Column.

2. During ondatasourcecontrolrowadding event, EmployeeId value is passed as 1 [Some Default value for to avoid Null exception ]. Please refer the following code snippet.

protected void GridGroupingControl1_DataSourceControlRowAdding(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridDataSourceControlRowAddingEventArgs e)
{
e.NewValues["EmployeeID"] = 1;
e.Handled = true;
}


3. In SqlDataSource1_Inserted event, EmployeeID value accessed through output parameter and the current record is updated with this value. Please refer the following code snippet.

protected void SqlDataSource1_Inserted(object sender, SqlDataSourceStatusEventArgs e)
{
string empID = e.Command.Parameters["@EmployeeID"].Value.ToString();
Record rec = this.GridGroupingControl1.Table.CurrentRecord;
rec.SetValue("EmployeeID", empID);
}


Please let me know if you have any concerns.

Regards,
M. Balaji

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.

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

;