471,072 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

SqlDataSource not getting update when using DataKeyNames

I am having problem updating the value of a texbox control inside a
gridview in which its bound field is also specified in DataKeyNames.
What I noticed is that If I remove accountid from DatakeyNames the
update works automatically with no code. So, now what I am trying to
do is to programatically update the database to overwrite the value of
the DatakeyName using the code below, but it seems that SqlDatasource
is ignoring it. Can someone confirm if DataKeyNames are supposed to be
used only with Databound fields and for Asp.net "zero code"? The
problem is I still need the datakeyName in other events, unless someone
can point out other ways to access the gridview datasource in form of a
dataview, for example....

protected void GridView1_RowUpdating(object sender,
GridViewUpdateEventArgs e)
SqlDataSource1.UpdateParameters["accountid"].DefaultValue =



Feb 10 '06 #1
1 1663
After some pain. I Found the answer reading this article.

I just had to use different names for my Stored Procedure parameters.
The default update will match any parameters with an exact match of a
field that exists in sqldatasoruce. And it works now..



Feb 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by stuart.d.jones | last post: by
3 posts views Thread by Ken Cox [Microsoft MVP] | last post: by
reply views Thread by =?Utf-8?B?UEs5?= | last post: by

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.