473,387 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

GridView update using ObjectDataSource

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
1 1632
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
1
by: A_StClaire_ | last post by:
hi all, I am using a GridView bound to an ObjectDataSource. edit and delete functionality has been enabled. my ObjectDataSource is tied to a TableAdapter that accesses three stored procedures...
5
by: GaryDean | last post by:
I have a GridView that works fine when I bind it to an ObjectDataSource at design time. But if I bind it at run time nothing happens. On a button click event I say... GridView1.DataSourceID =...
2
by: Greg | last post by:
Hello, I am trying to bind a GridView to a custom object I have created. First, here is what I'm trying to do: I have a wizard for adding/editing Users. When the wizard begins, a User...
3
by: pblack9455 | last post by:
I have a simple requirement to bind a small ArrayList of (ItemLine) Objects to a GridView control. The Gridview renders on the page and allows me to click update/edit buttons...however the data...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
4
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void...
4
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.