473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DAL and Gridview

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?
Aug 21 '08 #1
2 1618
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" <Ti***********@discussions.microsoft.comwrote in message
news:82**********************************@microsof t.com...
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?
Aug 21 '08 #2
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" <Ti***********@discussions.microsoft.comwrote in message
news:82**********************************@microsof t.com...
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?

Aug 21 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
1
by: joechipubik | last post by:
I have a GridView in a FormView that has as its datasource a DataTable that is stored in the session cache. When I first load the page the GridView is displayed correctly, but on subsequent loads...
3
by: Jeff | last post by:
Hey asp.net 2.0 In the source I posted below, there is a GridView (look at the bottom of the script): <asp:GridView ID="gvwOnline" runat="server"> </asp:GridView> I'm trying to assign a...
2
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few...
5
by: Andrew Robinson | last post by:
I am attempting to better automate a Pager Template within a GridView. I am succesfully skinning a Drop Down List withing my control (the DDL is added to my control). I correctly populate the item...
6
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
3
by: Peter | last post by:
I have a GridView which is populated by List<ofObjects> Does anyone have example of how to sort the columns of this GridView? I have found examples without DataSourceControl but these use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.