473,804 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best approach to use

J
I'm a bit new to asp.net and I'm investigating the best approach to this:

I have a contact table that includes stuff like Name, address, phone, etc.
Because each contact can contain multiple 'product' values, I have a
separate product table that has a many-to-one relationship with the contact
table. I also have an 'industry' table that also has a many-to-one
relationship with the contact table.

1. I would like to have a page that has a search box, and displays results
with summary info.

2. By clicking one of the records in the summary results, another page that
contains the contact edit screen comes up. This will include an 'product'
section and an 'industry' section which has check boxes to select all the
products or industries for this particular contact (looking up the values in
lookup tables).

Ideally, I could leverage asp.net controls as much as possible but sometimes
I seem to beat myself up trying go get them to do what I want them to do. I
can very quickly and easily do step number 1 by using a databound GridView
control. Yet it's not intuitive to my how to make the last name a link to
an edit page. Accomplishing number 2 seems to fall apart with the
many-to-one relationship data.

Any ideas on how to approach this would be appreciated.
Jan 7 '08 #1
2 1101
A real quick answer to one of your questions. How do you set the last
name to a link that will go to an edit page...

First, declare the OnDataBound property for the gridview. Then in the
code behind, in the OnDataBound function, check for the incoming data
to be an actual row of data and not a header or footer. Then when
inside that block, use the eventarg to set the column that holds the
last name as a link to a seperate page that processes the editing.

Here is some sample code:

IN THE ASPX FILE:

<asp:GridView ID="GridView1" runat="server"
OnDataBound="Gr idView1_RowData Bound">
</asp:GridView>

IN THE CODE BEHIND:

protected void GridView1_RowDa taBound(object sender,
GridViewRowEven tArgs e)
{
// Make sure we are processing a DataRow
if (e.Row.RowType == DataControlRowT ype.DataRow)
{
// Get last name, 0 is the first cell (column) in the
gridview, if you wanted a different cell, enter a different number
string lastName = e.Row.Cells[0].Text;

// Change last name to a link to edit page
e.Row.Cells[0].Text = "<a href='edit.aspx ?lastName="+
lastName + "</a>";
}
}

Of course, going off of this, you could pull the users id and pass
that to the edit page in case there are multiple last names. You
would just add that inside the RowDataBound function.

Then in the edit page, you will have to do some processing to get the
one-to-many relationship to work, but it's definately do-able!

Have fun!
Jan 7 '08 #2
It sounds to me that you want to have associative or "junction" tables.

CONTACT CONTACT_PRODUCT PRODUCT
========= ============= =======
CONTACT_ID CONTACT_ID PRODUCT_ID
PRODUCT_ID

The Contact_product table will have multiple entries for the same contact,
each one "pointing" to a product ID for that contact_ID in the PRODUCT table.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"J" wrote:
I'm a bit new to asp.net and I'm investigating the best approach to this:

I have a contact table that includes stuff like Name, address, phone, etc.
Because each contact can contain multiple 'product' values, I have a
separate product table that has a many-to-one relationship with the contact
table. I also have an 'industry' table that also has a many-to-one
relationship with the contact table.

1. I would like to have a page that has a search box, and displays results
with summary info.

2. By clicking one of the records in the summary results, another page that
contains the contact edit screen comes up. This will include an 'product'
section and an 'industry' section which has check boxes to select all the
products or industries for this particular contact (looking up the values in
lookup tables).

Ideally, I could leverage asp.net controls as much as possible but sometimes
I seem to beat myself up trying go get them to do what I want them to do. I
can very quickly and easily do step number 1 by using a databound GridView
control. Yet it's not intuitive to my how to make the last name a link to
an edit page. Accomplishing number 2 seems to fall apart with the
many-to-one relationship data.

Any ideas on how to approach this would be appreciated.
Jan 7 '08 #3

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

Similar topics

2
3844
by: Navin | last post by:
HI, Guys There has been a lot of Ways to use paging in asp 1>Recordset approach -where whole records are pulled at client side... and then only the records which are needed are filtered.. and now that is not the approach good as we are pulling unnesscary all the 10,000 say for dispalying 100 records...if pagesize is 100 2>i have seen is the Stored procedure approach where data is inserted
6
1861
by: Paul | last post by:
Hi. Just trying to find out the best approach as I beleive it might give me problems later on down the road. I have an ASP.NET application which references a shared database class which contains methods for serialising and de-serialising objects to the database storage. I put this as a shared class as multiple web clients will be using the class to store and retreive data, the problem I'm haivng now is that I think multiple threads...
136
9468
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
1
1744
by: Andy Britcliffe | last post by:
Hi I'm faced with the situation where I could have a single physical file that could contain multiplie XML documents e.g file.txt contains the following: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE doc SYSTEM "1.0b.dtd"> <doc transmission-date="20050715T154340Z" >
1
1594
by: milesm | last post by:
I've spent the last 3 hours reading various MSDN articles, other site articles and news group postings and was wondering what the best approach to my situation would be since I'm unable to come up with the best approach. What's Needed........ 1. Various background SQL inserts that don't interrupt the client request/response 2. Various background emails generated and sent that are separate from the client request/response 3. Every...
4
1421
by: David Pinx | last post by:
Greetings, I will be developing an application that will have two versions, a web application to be deployed at the client side and a windows application. The question is, what would be the best approach for developing these two versions reusing code as much as possible?. Is there a best practice for this type of development? I have read about User Interface Application Block, but I don't know at this
4
1844
by: Ned Balzer | last post by:
Hi all, I am pretty new to asp.net; I've done lots of classic asp, but am just beginning to get my mind wrapped around .net. What I'd like to do is include some code that tests if a user is logged in, on each and every page, and redirects the user to a login page if s/he's not logged in. The login page will also take care of some standard setup, such as choosing/populating a user profile. I used to use <!-- #include ... --for this,...
16
2824
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and efficient navigating within Visual Studio 2005. Let's say your project (or solution) has dozens of forms and hundreds or even thousands of routines. Two Questions: 1) BUILT-IN to Visual Studio 2005. What ideas do you have to quickly
6
3125
by: bill | last post by:
I am about to start on a module that will accept a location from a user, use Google geolocation services to get the lat/lon and then compute the distance from the site visitor to about 100 kennels (could grow to 1000 eventually). Once I have the distance I need to sort the kennels by distance and present those within 500 miles. Approach 1: read the kennel lat/lon from the mysql kennel record compute the distance
5
1395
by: gw7rib | last post by:
I'm writing a program which has "notes" - these can appear on the screen as windows with text in. It is possible to create an "index note" - at present, this will contain a list of the titles (or other data, you can choose) of some or all of the notes - you can choose the selection criteria. Thus you can create notes to store any text you want to, in a relatively free manner, but you can easily fish out all the notes relating to some...
0
9708
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
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
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...
0
10085
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...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
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
5527
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...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2998
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.