Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

ObjectDataSource and GridView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Just Me - 21 Mar 2008 14:01 GMT
Hi,

I am using the gridview with a business object ( just a function which
updates using a stored proc on sqo2005 ). Anyway.

Basically, the reord displayed in the grid is simple

ExpenseWeekID   WeekEndingDate   AmountPaid.

OK, now, when I click the edit link on the gridview, it puts the grid into
edit mode. ( Note that the ExpenseWeekID is listed as readonly as its the
primary key.

I Make my update to lets say the amountpaid and click Update.  This caused
my update function to be called and the parameters are passed to the
function.  these are the three already listed.

ExpenseWeekID   WeekEndingDate   AmountPaid.

However, the EspenseWeekID, is of course read only and the value passes is
allways ( 0 ) meaning that the update cannot work.  If I then change this
from read only so that when the grid is in edit mode, and then click update
the correct value is passed to my functiona and the update workds properly.

HOWEVER, I dont want the Primarykey to be in editable mode, how can I
overcome this without having to code all this manually.

Cheers
Just Me - 21 Mar 2008 14:24 GMT
Actually, I think ive found the answer.

One needs to use DataKeyNames="myKey" to tell the gridview what the key is
for the displayed records. However, this should have been automatic, I
assume it was the order in which I built the components on the page. I
guess, I should have defined the datasource before I created the gridview
????

> Hi,
>
[quoted text clipped - 25 lines]
>
> Cheers

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.