Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using objectdatasource and automated updates: receiving wrong parameters.

Reply
Thread Tools

Using objectdatasource and automated updates: receiving wrong parameters.

 
 
craigkenisston@hotmail.com
Guest
Posts: n/a
 
      02-03-2006
I have a grid attached to an objectdatasource from which just one field
is editable.
For the update method I have a method with two parameters, the key of
the record and the column to be updated.
However, what's happening is that I am receiving an empty key of the
record in my update method.

<asp:BoundField DataField="Key" HeaderText="Key" ReadOnly="True"
SortExpression="Key" />
<asp:BoundField DataField="AcceptReject" HeaderText="AcceptReject"
ReadOnly="False" SortExpression="AcceptReject" />

I notice that I I set Readonly False for the key expression, the
parameter is correctly received in the update method.
So, why should I have it editable in order to work ?
Is there any other way to take this parameters to the update method
without having to put my key in edit mode ?

 
Reply With Quote
 
 
 
 
S. Justin Gengo [MCP]
Guest
Posts: n/a
 
      02-04-2006
Craig,

Have you set the datakeynames property of the grid?

After setting it I retrieve my key from the gridview using the row's index:

Dim ItemId As Int32 =
CType(GridView1.DataKeys.Item(GridViewRow.RowIndex ).Value, Int32)



--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<> wrote in message
news: oups.com...
>I have a grid attached to an objectdatasource from which just one field
> is editable.
> For the update method I have a method with two parameters, the key of
> the record and the column to be updated.
> However, what's happening is that I am receiving an empty key of the
> record in my update method.
>
> <asp:BoundField DataField="Key" HeaderText="Key" ReadOnly="True"
> SortExpression="Key" />
> <asp:BoundField DataField="AcceptReject" HeaderText="AcceptReject"
> ReadOnly="False" SortExpression="AcceptReject" />
>
> I notice that I I set Readonly False for the key expression, the
> parameter is correctly received in the update method.
> So, why should I have it editable in order to work ?
> Is there any other way to take this parameters to the update method
> without having to put my key in edit mode ?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ObjectDatasource cannot find a non generic update method when using TableAdapter and deploying using WebSetUp Project rote ASP .Net 0 08-01-2008 07:24 AM
ObjectDataSource method as another ObjectDataSource David Thielen ASP .Net Web Controls 3 03-23-2006 01:50 AM
Wrong parameter being passed from an ObjectDataSource's SelectMethod Damon ASP .Net 2 02-03-2006 01:08 AM
An Automated process of watching a network file folder, reading a file in it and deleting the file using ASP.NET ? Luis Esteban Valencia Muñoz ASP .Net 3 06-04-2005 10:56 AM
not receiving email,is anything wrong? =?ISO-8859-1?Q?R=F4g=EAr?= Computer Support 3 07-28-2004 10:32 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57