How to pass back the new added row key value to webgrid in client bidning mode

22 replies. Last post: November 12, 2012 8:44 PM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi,

 I’ve WebGrid, and defined BindingOperationMode="ClientBinding" AllowAddNew="Yes". Also set DataSourceType="WebService".  

I’ve this code for the insert function in the webservice:

private TransactionResult InsertMembershipTypePrice(MembershipTypePrice newObject, int nPriceType)
{
Medcan.Business.MembershipTypePrice price = new Medcan.Business.MembershipTypePrice();

price.MembershipTypeID = newObject.MembershipTypeID;
price.IsActive = newObject.IsActive;
price.EffectiveDate = newObject.EffectiveDate;
price.EndDate = newObject.EndDate;
price.Description = newObject.Description;
price.PriceFlag = nPriceType;

price.MemberCategory = GetComboConfigID(newObject.MemberCategoryName, "MembershipCategory");
Decimal nTemp = 0;
Decimal.TryParse(newObject.MemberPrice, out nTemp);
price.MemberPrice = nTemp;

using (TransactionScope scope = new TransactionScope())
{
price.Save();
newObject.MembershipTypePriceID = price.MembershipTypePriceID;
scope.Complete();
}

MembershipDataContext context = new MembershipDataContext();
return new TransactionResult()
{
OperationType = DataSourceOperation.Insert,
ReturnValue = true,
AffectedResults = newObject.MembershipTypePriceID
};
}


How can the grid recognize the new added row key value, like when I add a new record in the database, how can I pass back the new row key value to the grid?

Thanks,

Maged Mikaeel

All times are GMT -5. The time now is 2:33 PM.
Previous Next