GridView ( TEARING HAIR OUT )

J

Just Me

* Remember this is a ASP.NET web application *

Ive been fu**ing about with this for a day or two now as and when Ive had
the time, and I cannot get it to work.


OK, I have created a DataTable Table adapter, this works fine and fill the
grid OK, I can cause and edit event to fire and bring up the text boxes for
in place editing, ( No different to DataGrid 1.x right ? )

OK, Now I need to click on the update button to fire the update event., We
cool so far ??

OK, here is the rub.

I cannot determine how to update the underlying dataTable because there is
no data available in the gridVewEvent args in which to be able to do the
update.

Now dont say use Cells(n) because it does not exist in gridviewArgs ( as far
as I can see ), so Im sure Im missing something fundamental here and simply
cannot see it.


Can someone PLEASE put me out of my misery and tell me how to do this.
 
J

Jim Rand

I've been doing Windows forms development using the DevExpress controls.

On a lark, I did the following:

1) Started a new C# web project.
2) Dragged a SqlDataSource onto the Default.aspx and configured it for the
Northwind Product table with update capabilities.
3) Dragged the DevExpress aspx data grid onto the form and bound it to the
SqlDataSource.
4) Ran it. Full in place editing with backend update.

No code - cool. Took about 2 minutes.
 
J

Just Me

yeah, now try in on a web application.




Jim Rand said:
I've been doing Windows forms development using the DevExpress controls.

On a lark, I did the following:

1) Started a new C# web project.
2) Dragged a SqlDataSource onto the Default.aspx and configured it for the
Northwind Product table with update capabilities.
3) Dragged the DevExpress aspx data grid onto the form and bound it to the
SqlDataSource.
4) Ran it. Full in place editing with backend update.

No code - cool. Took about 2 minutes.
 
J

Just Me

OK, now I see. This does work differently to the old GridView, if you dont
have the DataSource configured with it, it never passes the values to the
update events.

Im not sure how table adapters fit into this scenario, as it would seem that
they are pretty much useless in terms of managing the databound controls and
it is only the datasoruces which will be of much use.

I may be totally wrong, I guess I will see as I go along,.


Cheers
 
J

Jim Rand

Hope that answered the question. If you read between the lines, consider
using third party controls (DevExpress) to make you life a lot easier. Just
to make certain, that was a web app that took less than two minutes to
create and configure with full update. What was really interesting is you
can update multiple rows in the grid on the client before submitting it back
to the server.
 
J

Just Me

OK Jim,

Thanks for that information. But this has still left me with unanswered
questions about the out-of-box offering from Microsoft.


In 1.x, I knew where I was with everything, but the databound controls seem
to be easy to use one one level, but Im confused about how they best fit
strategically in terms of setting up a DAL
 
M

Mark Rae

In 1.x, I knew where I was with everything, but the databound controls
seem to be easy to use one one level, but Im confused about how they best
fit strategically in terms of setting up a DAL

You've hit the nail on the head - they don't...
 
V

vMike

Just Me said:
* Remember this is a ASP.NET web application *

Ive been fu**ing about with this for a day or two now as and when Ive had
the time, and I cannot get it to work.


OK, I have created a DataTable Table adapter, this works fine and fill
the grid OK, I can cause and edit event to fire and bring up the text
boxes for in place editing, ( No different to DataGrid 1.x right ? )

OK, Now I need to click on the update button to fire the update event., We
cool so far ??

OK, here is the rub.

I cannot determine how to update the underlying dataTable because there is
no data available in the gridVewEvent args in which to be able to do the
update.

Now dont say use Cells(n) because it does not exist in gridviewArgs ( as
far as I can see ), so Im sure Im missing something fundamental here and
simply cannot see it.


Can someone PLEASE put me out of my misery and tell me how to do this.
Have you looked into gridview onEdit and onUpdating events. That is were you
should be with this.
 
V

vMike

vMike said:
Have you looked into gridview onEdit and onUpdating events. That is were you
should be with this.

Here is some code snip

Sub FileGrid_Updating(sender as object, e as GridViewUpdateEventargs)
Dim key as DataKey = FileGrid1.Datakeys(e.rowindex)
dim KeyValue as int32 = ctype(key.value, int32)
'handle here


End Sub

Sub FileGrid_Edit(sender as object, e as GridViewEditEventargs)
Dim key as DataKey = FileGrid1.Datakeys(e.neweditindex)
dim keys as datakeyArray = FileGrid1.Datakeys
dim keyindex as string = key.item(0).tostring()

'handle here

End Sub
 
J

Just Me

Im not sure how to respond to your answer. Are you saying that in your
opinion MS have screwed it up in this respect, or are you saying that a DAL
is old hat and should be discarded ?
 
M

Mark Rae

Are you saying that in your opinion MS have screwed it up in this respect,

No - it's just my opinion that the new SqlDataSource and ObjectDataSource
controls etc are really aimed more at enticing FrontPage users to VS.NET
and, as such, have very little benefit to developers who prefer a little
more control over their apps...

Just my opinion - as always, some people agree, others don't...
or are you saying that a DAL is old hat and should be discarded ?

Absolutely not! Quite the reverse! Once you have a tight and robust DAL that
you're happy with, IMO there's never any need to use anything else...
 
J

Just Me

Cool, thanks for that input, I thought it was just me, but it looks as if im
not the only one who is
thinking along those lines.
 
J

Just Me

This only works with a Data Source, but it has nevertheless answered a
question. Gridviews are sh*t compared with DataGrids. They have limited our
control.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top