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

  • Thread starter Thread starter adam222
  • Start date Start date
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
 
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?
 
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
 
You are manipulating the data by updating through the DataSource object.
What does it matter where the updating (generic term) is being performed?
 
Back
Top