By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Jan 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"adam222" <ad*****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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

Jan 16 '06 #2

P: n/a
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

Jan 16 '06 #3

P: n/a
You are manipulating the data by updating through the DataSource object.
What does it matter where the updating (generic term) is being performed?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"adam222" <ad*****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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

Jan 18 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.