GridView Control in ASP.NET 2.0 is updating/deleting only via SqlDataSource

A

adam222

hello,
i have a web-form with a GridView control, i wanted to update & delete,
using the AutoGenerateEditButton.

when i used it with sqlDataSource (executing SP in the DB) it works
like a charm, but when i want to pass the data through the
application's layers (BL etc.), it did not work.

it seems that the 'AutoGenerateEditButton' is capable only with
sqlDataSource...

so i tried a work around:
protected void SqlDataSource1_Deleting(object sender,
SqlDataSourceCommandEventArgs e)
{
//get parameters
int systemId = X;

//use service to delete (layer)
Services.X APS = new Services.X();
serviceAPS.ServiceExecution(aps, null, ServiceActions.Delete);

//cancel original event
e.Cancel = true;

//reload data
GridView1.DataBind();
}

this worked! but this is crooked... i use the event of the
sqlDataSource to init a method & then canceling it...
the other thing that i have a problem with: the grid's binding is only
via sqlDataSource inner 'SelectCommand'

does anyone have a clue how can i use the edit/update/delete buttons
within the GridView & not with sqlDataSource?

thank you,
Adam
 
C

Christopher Reed

I think you are looking at this incorrectly. The GridView is only for
displaying the data; the SqlDataSource is for manipulating the data. If you
don't have a DataSource, then you cannot use the GridView.

So, what are you looking for? What are your expectations?
 
A

adam222

hey there christopher,

my expectations from the grid is to manipulate the data,
but for now i have a solution, the object 'ObjectDataSource' :)

thank you,
Adam
 
C

Christopher Reed

You are manipulating the data by updating through the DataSource object.
What does it matter where the updating (generic term) is being performed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top