Hi Olivier,
Using a simple business object and DAL class doesn't reproduce the issue
you're experiencing:
namespace mynamespace
{
public class Product
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private string _code;
public string Code
{
get { return _code; }
set { _code = value; }
}
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
public Product()
{
}
public Product(int p_id, string p_code, string p_name)
{
_id = p_id;
_code = p_code;
_name = p_name;
}
}
public class Products
{
public List<Product> GetAllProducts()
{
List<Product> list = new List<Product>();
for (int i = 0; i < 10; i++) {
list.Add(new Product(i, "code" + i.ToString(), "name" +
i.ToString()));
}
return list;
}
public void Update(Product p)
{
}
}
}
<asp:GridView ID="GridView1" runat="server" DataKeyNames="Id"
AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" >
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="Id" HeaderText="Id"
SortExpression="Id" ReadOnly="True" />
<asp:BoundField DataField="Code" HeaderText="Code"
SortExpression="Code" />
<asp:BoundField DataField="Name" HeaderText="Name"
SortExpression="Name" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DataObjectTypeName="mynamespace.Product"
SelectMethod="GetAllProducts" TypeName="mynamespace.Products"
UpdateMethod="Update">
</asp:ObjectDataSource>
Your project is certainly more complicated than this. Would you please
create a reproducible project and post it here or send it to me directly?
Thank you.
Sincerely,
Walter Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.