Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Gridview/SqlDataSource not updating

13 views
Skip to first unread message

tshad

unread,
Sep 22, 2009, 3:57:01 PM9/22/09
to
I have a GridView that I am using to update my tables using inline editing
(CommandField).

It works fine and updates the table using the onRowUpdating event of the
GridView.

But I am getting the error:

Updating is not supported by data source 'SqlDataSource1' unless
UpdateCommand is specified.

I don't want the SqlDataSource1 to update my tables, I would like it to
redisplay the line I changed, however.

Someone suggested I try setting:

GridView1.EditIndex = -1

But that didn't work.

Is there a way around this?

Thanks,

Tom


tshad

unread,
Sep 22, 2009, 4:06:39 PM9/22/09
to
I tried to fake it out by adding a Stored procedure that does nothing and
got a message:

Procedure has no parameters and parameters were supplied.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectString %>"
SelectCommand="GetResponseFileExceptions"
SelectCommandType="StoredProcedure"
UpdateCommand="UpdateDummy"
UpdateCommandType="StoredProcedure"></asp:SqlDataSource>

I don't see any parameters???

Thanks,

Tom

"tshad" <to...@pdsa.com> wrote in message
news:%23Bq7a77...@TK2MSFTNGP04.phx.gbl...

tshad

unread,
Sep 23, 2009, 11:52:27 AM9/23/09
to
It turns out I needed to set my BIND to EVAL in my GridView and it works
fine.

But how do I tell it not to update at all?

I want to handle it myself. There would actually be a couple of ways I need
to call my update statement with different parameters and actually different
Stored procedures.

That was why I was doing it in the onRowUpdating event of the GridView.

Thanks,

Tom

"tshad" <to...@pdsa.com> wrote in message

news:%23%234MzA8O...@TK2MSFTNGP05.phx.gbl...

tshad

unread,
Sep 28, 2009, 1:23:12 PM9/28/09
to
Finally, figured it out.

You have to cancel the update and set EditIndex = -1 in the RowUpdating
event of the GridView:

public void GridView1_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{

e.Cancel = true; // Prevents error on not including
UpdateMethod in SDS

... Some Code

GridView1.EditIndex = -1;
}

Need both to prevent the error.

"tshad" <to...@pdsa.com> wrote in message

news:uvE9aXGP...@TK2MSFTNGP06.phx.gbl...

PAVAN

unread,
Dec 25, 2009, 1:13:02 AM12/25/09
to
ThanQ very much this helped me a lot...........
0 new messages