By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,386 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,386 IT Pros & Developers. It's quick & easy.

GridView update using ObjectDataSource

P: n/a
Hi,
I have a problem in which I'm using a GridView with an
ObjectDataSource as a data source. The problem is that when I use the
ObjectDataSource UPDATE routine I must have the key column displayed
(and editable) in the GridView! This is a problem because this key
column is the database table key value and can't be changed. If I
don't display the key column or if I set it as ReadOnly then the
ObjectDataSource UPDATE routine dosen't see the key and the WHERE
clause fails.. As in:

UPDATE tablename
Set .....
Where key_column = @key_column

Thanks in advance for your help.
Steve

Sep 10 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Have you set the DataKeyNames Property (in Gridview) to your Primary key
column?
And, you definitely do not want the key column editable

David Wier
http://aspnet101.com
http://iWritePro.com - PDF in one click/export .doc/.rtf to HTML with no
bloat
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11**********************@y42g2000hsy.googlegr oups.com...
Hi,
I have a problem in which I'm using a GridView with an
ObjectDataSource as a data source. The problem is that when I use the
ObjectDataSource UPDATE routine I must have the key column displayed
(and editable) in the GridView! This is a problem because this key
column is the database table key value and can't be changed. If I
don't display the key column or if I set it as ReadOnly then the
ObjectDataSource UPDATE routine dosen't see the key and the WHERE
clause fails.. As in:

UPDATE tablename
Set .....
Where key_column = @key_column

Thanks in advance for your help.
Steve

Sep 11 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.