473,666 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Basic databinding question

Considering a typical scenario where the user is presented a list of
customers and, upon selecting one and clicking a button, they are then
presented with a new page depicting the orders for that customer and
the detail items for each order, what is the conventional (best) way to
"pass" the CustomerID from the first page to the second page and then
use it to only select the relevant orders to display as well as only
the relevant order detail items? Are session variables used for this?

Rich

Jul 8 '06 #1
4 1145
Richard,

IMO, I would use a multi-view and just have a grid of each set of
detail on a different view. Tie each grid, Customer, Order, and Item
to a SqlDataSource to populate the grids. The Orders grid
SqlDataSource should have a Select parameter relying on the
SelectedValue of the Customers Grid (where the DataKeyName is
CustomerID). In kind, also do this for the relationship between the
Order Grid (again where the DataKeyName is OrderID) the Item Grid.

For easy to understand tutorials on all this, visit the www.asp.net
site.

I would not use Session variables in this case.

HTH,
Chris

Jul 8 '06 #2
chris wrote:
Richard,

IMO, I would use a multi-view and just have a grid of each set of
detail on a different view. Tie each grid, Customer, Order, and Item
to a SqlDataSource to populate the grids. The Orders grid
SqlDataSource should have a Select parameter relying on the
SelectedValue of the Customers Grid (where the DataKeyName is
CustomerID). In kind, also do this for the relationship between the
Order Grid (again where the DataKeyName is OrderID) the Item Grid.

For easy to understand tutorials on all this, visit the www.asp.net
site.

I would not use Session variables in this case.
I'm all for avoiding Session variables where possible, but in your
example how would entry of new orders or new detail items be
accomplished - by clicking an add button and entering the information
directly into the grid? While that provides a nice clean interface and
functionality from the development standpoint, I don't think it makes
for a very intuitive or user-friendly interface.

Perhaps it is due to the fact that I am coming from a windows
development mindset, but I've never been a fan of grid-based data
entry.

Any other ideas?

Rich

Jul 8 '06 #3
For the data entry part, you can use a form view for entering in new
data. As soon as the data is entered, you can bring them back to the
appropriate grid and call the GridView.Databi nd() method to refresh the
data.

If you want to make it like a WF environment, then you will probably
need to employ a bunch of jscript and utilize AJAX. The 2.0
environment does have some nice functionality built in though for the
GridView when it comes to AJAX, you can turn EnableAsyncCall back in the
control (I think) and then paging and sorting become a callback instead
of a postback.

One thing I just thought of is you could use the new CrossPagePostba ck
or Server.Transfer to transfer data from the previous page to the new
page. While they two functions are similar, it seems that the
crosspage postback actually processes the previous page again before
processing the new page. Server.Transfer () only passes the viewstate I
think. In either case you can pass controls or simple types via a
public property.

public int CustomerID
{
get{ return int.Parse(gridv iewCustomer.Sel ectedValue);}
}

If you want to get more functionality then this, you may need to hire a
consultant, or build your own controls, or purchase a third party
control.

HTH,
Chris

Richard Carpenter wrote:
chris wrote:
Richard,

IMO, I would use a multi-view and just have a grid of each set of
detail on a different view. Tie each grid, Customer, Order, and Item
to a SqlDataSource to populate the grids. The Orders grid
SqlDataSource should have a Select parameter relying on the
SelectedValue of the Customers Grid (where the DataKeyName is
CustomerID). In kind, also do this for the relationship between the
Order Grid (again where the DataKeyName is OrderID) the Item Grid.

For easy to understand tutorials on all this, visit the www.asp.net
site.

I would not use Session variables in this case.

I'm all for avoiding Session variables where possible, but in your
example how would entry of new orders or new detail items be
accomplished - by clicking an add button and entering the information
directly into the grid? While that provides a nice clean interface and
functionality from the development standpoint, I don't think it makes
for a very intuitive or user-friendly interface.

Perhaps it is due to the fact that I am coming from a windows
development mindset, but I've never been a fan of grid-based data
entry.

Any other ideas?

Rich
Jul 8 '06 #4
Thanks a bunch. I had seen Server.Transfer () mentioned before, but
never understood what it was for. After a little digging, I think that
is the way to go.

Thanks again.
Rich

chris wrote:
For the data entry part, you can use a form view for entering in new
data. As soon as the data is entered, you can bring them back to the
appropriate grid and call the GridView.Databi nd() method to refresh the
data.

If you want to make it like a WF environment, then you will probably
need to employ a bunch of jscript and utilize AJAX. The 2.0
environment does have some nice functionality built in though for the
GridView when it comes to AJAX, you can turn EnableAsyncCall back in the
control (I think) and then paging and sorting become a callback instead
of a postback.

One thing I just thought of is you could use the new CrossPagePostba ck
or Server.Transfer to transfer data from the previous page to the new
page. While they two functions are similar, it seems that the
crosspage postback actually processes the previous page again before
processing the new page. Server.Transfer () only passes the viewstate I
think. In either case you can pass controls or simple types via a
public property.

public int CustomerID
{
get{ return int.Parse(gridv iewCustomer.Sel ectedValue);}
}

If you want to get more functionality then this, you may need to hire a
consultant, or build your own controls, or purchase a third party
control.

HTH,
Chris

Richard Carpenter wrote:
chris wrote:
Richard,
>
IMO, I would use a multi-view and just have a grid of each set of
detail on a different view. Tie each grid, Customer, Order, and Item
to a SqlDataSource to populate the grids. The Orders grid
SqlDataSource should have a Select parameter relying on the
SelectedValue of the Customers Grid (where the DataKeyName is
CustomerID). In kind, also do this for the relationship between the
Order Grid (again where the DataKeyName is OrderID) the Item Grid.
>
For easy to understand tutorials on all this, visit the www.asp.net
site.
>
I would not use Session variables in this case.
>
I'm all for avoiding Session variables where possible, but in your
example how would entry of new orders or new detail items be
accomplished - by clicking an add button and entering the information
directly into the grid? While that provides a nice clean interface and
functionality from the development standpoint, I don't think it makes
for a very intuitive or user-friendly interface.

Perhaps it is due to the fact that I am coming from a windows
development mindset, but I've never been a fan of grid-based data
entry.

Any other ideas?

Rich
Jul 8 '06 #5

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

Similar topics

0
955
by: Victor Jones | last post by:
I have a general question about the approach towards databinding controls with objects. Apart from the databinding offered by .NET to bind data, it can be extended to have the same behavior with objects. Although, it seems a better way of doing things and provides an abstraction of code base, it hampers performance, as compared to the traditional approach. But just in the context of approach towards best practices towards developing...
0
1072
by: Victor Jones | last post by:
I have a general question about the approach towards databinding controls with objects. Apart from the databinding offered by .NET to bind data, it can be extended to have the same behavior with objects. Although, it seems a better way of doing things and provides an abstraction of code base, it hampers performance, as compared to the traditional approach. But just in the context of approach towards best practices towards developing...
3
1096
by: Mike Christie | last post by:
I've got some Java experience but no JSP or ASP and am trying to get to grips with ASP.NET. I'd appreciate some help on a simple question. I have been able to get databinding to work, and can display a string obtained from the database on the screen by binding it to a label. However, if I have an object instantiated in the page's scope, it seems like there should be an easier way to output a string that I obtain from that object. I...
4
1296
by: Jason S | last post by:
I haven't been able to find a clear answer to this and I'm hoping someone could enlighten me. As pertains to databinding a control in a repeating fashion(datagrid, repeater, etc.) what event would one handle to get a handle on things just BEFORE the data is bound. To be clearer, not controlling the formatting of the bound control(backcolor or what have you), but rather control the WAYor even IF the data is bound at all. For instance,...
4
4203
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox), SqlConnection (sqlConnection), SqlDataAdapter (daLookupData), SqlDataAdapter (daData), DataSet (dsLookupData), and DataSet (dsData), all created via the IDE during design-time. Here is the design of my simple tables: (An example since I can't post my...
2
1678
by: Al Smith | last post by:
I kind of understand how the below works, however I am trying to do it at runtime vrs design time. <asp:TextBox id="TextBox1" runat="server" Text='<%# StateList.SelectedItem.Text %>'></asp:TextBox> So what I really want to do is something like I show below. In Page_Load I have: TextBox txt; txt= new TextBox();
2
1758
by: Shane | last post by:
When I click on the DataBinding in the properties window a list of options open up called Advanced,Tag and Text. I would like to know what Tag and Text are set to? I hope to Bind a text box to a Access database in my program. -- I am a Noob! Thanks for the Help :)
9
2095
by: Dennis | last post by:
I have tried using Databinding for my application but always seem to find it very restrictive (maybe I don't completely understand it enough). I always seem to find it much easier to display a form, have the user fill it out then put the data into a class representing a data row and then use the OLEadaptor or OLECommands to update the database. My question is has anyone really used databinding in anything but the simpliest application...
5
1804
by: Aussie Rules | last post by:
Hi, Having a mental block on this one. Have done it before but can't rack my brain on how... I have an object, with a bunch on property, and I add that object to a combo box. I want the property '.fulladdress' to be the value that appears in the drop downs text section. How to I set that parameter to be the one shown inthe drop down
5
12516
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I update the datasource - awesome, but I have an issue with updating from a different thread. Here is my datasource, a person class that raises the PropertyChanged event: class Person : INotifyPropertyChanged {
0
8443
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.