I have my own object class which I use as the data source for gridview. I am binding the columns to class properties which display perfectly fine. However it does not save on edit. I am wondering how do I save changes from Gridview? Specifically is there anyway to call the SET method in my class properties? Here is some code snipit:
Note: I am using my object directly as the datasource, and not through the ObjectDataSource interface. So I can’t use the updateMethod.
Binding:
<asp:TextBox ID="txb_customerName" runat="server" Text='<%# Bind("customerName") %>' />
Object Property:
public string customerName
{
get
{
if (!_loaded) { load(); }
return _customerName;
}
set { _customerName = value; }
}
Try setting the updatemethod property of the object datasource (see link). The update method is the name of the method you use to update/save the record in the class.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.updatemethod.aspx