PC Review


Reply
Thread Tools Rate Thread

DAL and Gridview

 
 
Tim Tafflinger
Guest
Posts: n/a
 
      21st Aug 2008
I've created a DAL and can use the methods to load and manipulate data in a
gridview when it is bound to an objectdatasource. But I've been told with a
DAL I don't need an objectdatasource at all but I'm having difficulty
figuring out how to do it. Loading the data in the gridview is no problem,
it's the updating and deleting that won't work. When I click on the Edit or
Delete buttons I get an unhandled event error so apparently I need to use
those events somehow but haven't been able to figure it out and all the
examples I can find use an objectdatasource. Can someone point me in the
right direction?
 
Reply With Quote
 
 
 
 
Jonathan Wood
Guest
Posts: n/a
 
      21st Aug 2008
If you use the wizards, you still have access to the data source's Update,
Insert, and Delete commands (in addition to the select commands). Of course,
you'll need to select the appropriate methods on your object for each
command and ensure the proper arguments are being supplied.

If you don't want a data source control, just set the GridView's DataSource
property in your page's Load event and call DataBind.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


"Tim Tafflinger" <(E-Mail Removed)> wrote in message
news:82A6B848-6F7E-43BF-9B96-(E-Mail Removed)...
> I've created a DAL and can use the methods to load and manipulate data in
> a
> gridview when it is bound to an objectdatasource. But I've been told with
> a
> DAL I don't need an objectdatasource at all but I'm having difficulty
> figuring out how to do it. Loading the data in the gridview is no
> problem,
> it's the updating and deleting that won't work. When I click on the Edit
> or
> Delete buttons I get an unhandled event error so apparently I need to use
> those events somehow but haven't been able to figure it out and all the
> examples I can find use an objectdatasource. Can someone point me in the
> right direction?


 
Reply With Quote
 
Tim Tafflinger
Guest
Posts: n/a
 
      21st Aug 2008
I used the wizards to create the DAL and specified the sprocs for the CRUD
procedures and it all works great with the objectdatasource. With no data
source control at all I am able to do just what you said and bind to the
gridview on the page load event. But when I click the Edit link button in
the grid I get an "The GridView 'GridView1' fired event RowEditing which
wasn't handled" error. So it seems obvious that in the RowEditing event I
need to set up the gridview for editing then there is probably a RowUpdating
event that where I need to access the methods in my DAL to do the update but
I just haven't been able to figure it out.

"Jonathan Wood" wrote:

> If you use the wizards, you still have access to the data source's Update,
> Insert, and Delete commands (in addition to the select commands). Of course,
> you'll need to select the appropriate methods on your object for each
> command and ensure the proper arguments are being supplied.
>
> If you don't want a data source control, just set the GridView's DataSource
> property in your page's Load event and call DataBind.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
> "Tim Tafflinger" <(E-Mail Removed)> wrote in message
> news:82A6B848-6F7E-43BF-9B96-(E-Mail Removed)...
> > I've created a DAL and can use the methods to load and manipulate data in
> > a
> > gridview when it is bound to an objectdatasource. But I've been told with
> > a
> > DAL I don't need an objectdatasource at all but I'm having difficulty
> > figuring out how to do it. Loading the data in the gridview is no
> > problem,
> > it's the updating and deleting that won't work. When I click on the Edit
> > or
> > Delete buttons I get an unhandled event error so apparently I need to use
> > those events somehow but haven't been able to figure it out and all the
> > examples I can find use an objectdatasource. Can someone point me in the
> > right direction?

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView's selection isn't causing other GridView's to load data asexpected Rasika WIJAYARATNE Microsoft ASP .NET 0 14th Dec 2007 12:25 AM
Creating custom gridview (inheriting from gridview class) =?Utf-8?B?V2ViTWF0cml4?= Microsoft ASP .NET 1 22nd Oct 2006 12:56 AM
Deleting row from GridView causes ArgumentOutOfRangeException during System.Web.UI.WebControls.GridView.set_SelectedIndex(Int32 value) loga123 Microsoft ASP .NET 2 28th Jun 2006 09:32 PM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= Microsoft ASP .NET 1 9th May 2006 07:48 PM
Gridview with combobox whose data is dependent on field in gridview wallermj@hotmail.com Microsoft ASP .NET 3 21st Nov 2005 05:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:35 PM.