Hello,
Got a kind of e-commerce site.
There are products with product options, such as color, size, etc
All are defined a table:
tbl_products: the table with the products.
tbl_options: the table with the options (Columns are: optionID,
parentoptionID, optionname).
Ex. of content for tbl_options:
1, 0, color
2, 1, yellow
3, 1, green
4, 1, blue
5, 0, size
6, 5, small
7, 5, medium
8, 5, large
I want a webpage that generates the product info from tbl_products (that's
no problem)
and that generates a way of selecting the options from tbl_options.
The user can select the options and add the product to the shopping cart.
So, a dynamically created dropdown would be great, but it could also be done
with a dynamically created radiobuttonlist.
Ex:
color: [here comes dropdown1 with: yellow, green, blue]
size: [here comes dropdown2 with: small, medium, large]
It should be an obvious problem as almost all e-commerces offer the ability
to select options for a product.
I really hope someone can help me implement this in asp.NET, or at least
tell me where to find a tutorial.
NB: I code in VB.net.
Thanks in advance,
Nic 7 1312
Nick,
One way to solve this is to use a stored procedure to perform 2 selects (one
for the colors, one for the sizes) and fill a DataSet. This should generate
two DataTables in the DataSet.
Next, simply add two DropDownList controls to your webform.
In the code, simply perform databinding like so:
MyDropDownList.DataSource = MyDataSet.Tables[0];
MyDropDownList.DataBind();
MyOtherDropDownList.DataSource = MyDataSet.Tables[1];
MyOtherDropDownList.DataBind();
Keep in mind that you only have to DataBind the first time the user views
the page if you have ViewState enabled. So you should wrap those two with
the following:
if(!Page.IsPostBack){
// CALL FUNCTION TO DO DATA RETRIEVAL AND BINDING
}
"nicholas" wrote: Hello,
Got a kind of e-commerce site. There are products with product options, such as color, size, etc
All are defined a table: tbl_products: the table with the products. tbl_options: the table with the options (Columns are: optionID, parentoptionID, optionname).
Ex. of content for tbl_options: 1, 0, color 2, 1, yellow 3, 1, green 4, 1, blue 5, 0, size 6, 5, small 7, 5, medium 8, 5, large
I want a webpage that generates the product info from tbl_products (that's no problem) and that generates a way of selecting the options from tbl_options. The user can select the options and add the product to the shopping cart.
So, a dynamically created dropdown would be great, but it could also be done with a dynamically created radiobuttonlist. Ex: color: [here comes dropdown1 with: yellow, green, blue] size: [here comes dropdown2 with: small, medium, large]
It should be an obvious problem as almost all e-commerces offer the ability to select options for a product.
I really hope someone can help me implement this in asp.NET, or at least tell me where to find a tutorial.
NB: I code in VB.net.
Thanks in advance, Nic
Asp.net has a radiobuttonlist web server control which you can databind it
will any array of values or from a database. You would need to set it
datasource property = to your datasource and then bind the control
"nicholas" wrote: Hello,
Got a kind of e-commerce site. There are products with product options, such as color, size, etc
All are defined a table: tbl_products: the table with the products. tbl_options: the table with the options (Columns are: optionID, parentoptionID, optionname).
Ex. of content for tbl_options: 1, 0, color 2, 1, yellow 3, 1, green 4, 1, blue 5, 0, size 6, 5, small 7, 5, medium 8, 5, large
I want a webpage that generates the product info from tbl_products (that's no problem) and that generates a way of selecting the options from tbl_options. The user can select the options and add the product to the shopping cart.
So, a dynamically created dropdown would be great, but it could also be done with a dynamically created radiobuttonlist. Ex: color: [here comes dropdown1 with: yellow, green, blue] size: [here comes dropdown2 with: small, medium, large]
It should be an obvious problem as almost all e-commerces offer the ability to select options for a product.
I really hope someone can help me implement this in asp.NET, or at least tell me where to find a tutorial.
NB: I code in VB.net.
Thanks in advance, Nic
First, thank you for your reply!
What you explain would be no problem to do, indeed.
But the problem is that a product can have more than 2 options or none and
not always color and size.
In fact in my backofice, when I add a new product, I can add as much options
as I need for the product.
Another example could be what you get when you configure a computer on
Dell.com.
For 1 model you have at least 10 options: monitor, processor, HD, etc
So, just like on Dell, I would need dropdownboxes to be generated
dynamicaly, depending on the options for that product, found in the
tbl_options.
I should also say that the tbl_options contains a column "productID".
Don't hesitate to ask me more, if it's not clear !
Thanks a lot,
Nic
"Charles Chen" <Ch*********@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com... Nick,
One way to solve this is to use a stored procedure to perform 2 selects
(one for the colors, one for the sizes) and fill a DataSet. This should
generate two DataTables in the DataSet.
Next, simply add two DropDownList controls to your webform.
In the code, simply perform databinding like so:
MyDropDownList.DataSource = MyDataSet.Tables[0]; MyDropDownList.DataBind();
MyOtherDropDownList.DataSource = MyDataSet.Tables[1]; MyOtherDropDownList.DataBind();
Keep in mind that you only have to DataBind the first time the user views the page if you have ViewState enabled. So you should wrap those two with the following:
if(!Page.IsPostBack){ // CALL FUNCTION TO DO DATA RETRIEVAL AND BINDING }
"nicholas" wrote:
Hello,
Got a kind of e-commerce site. There are products with product options, such as color, size, etc
All are defined a table: tbl_products: the table with the products. tbl_options: the table with the options (Columns are: optionID, parentoptionID, optionname).
Ex. of content for tbl_options: 1, 0, color 2, 1, yellow 3, 1, green 4, 1, blue 5, 0, size 6, 5, small 7, 5, medium 8, 5, large
I want a webpage that generates the product info from tbl_products
(that's no problem) and that generates a way of selecting the options from tbl_options. The user can select the options and add the product to the shopping
cart. So, a dynamically created dropdown would be great, but it could also be
done with a dynamically created radiobuttonlist. Ex: color: [here comes dropdown1 with: yellow, green, blue] size: [here comes dropdown2 with: small, medium, large]
It should be an obvious problem as almost all e-commerces offer the
ability to select options for a product.
I really hope someone can help me implement this in asp.NET, or at least tell me where to find a tutorial.
NB: I code in VB.net.
Thanks in advance, Nic
Thx for your reply.
I could do this, indeed, but the control should be generated dynamically.
I replied to Charles' message with more details on what I want to do, as I
think I was not understood 100%.
I already tried to implement something with the radiobuttonlist, but I
didn't got it working and I would prefer dropdownboxes ;-)
Check out my reply on Charles' message, you may understand better what I
want to do.
Anyway, thank again for your help,
Nic
"Tampa .NET Koder" <Ta***********@discussions.microsoft.com> wrote in
message news:8F**********************************@microsof t.com... Asp.net has a radiobuttonlist web server control which you can databind it will any array of values or from a database. You would need to set it datasource property = to your datasource and then bind the control "nicholas" wrote:
Hello,
Got a kind of e-commerce site. There are products with product options, such as color, size, etc
All are defined a table: tbl_products: the table with the products. tbl_options: the table with the options (Columns are: optionID, parentoptionID, optionname).
Ex. of content for tbl_options: 1, 0, color 2, 1, yellow 3, 1, green 4, 1, blue 5, 0, size 6, 5, small 7, 5, medium 8, 5, large
I want a webpage that generates the product info from tbl_products
(that's no problem) and that generates a way of selecting the options from tbl_options. The user can select the options and add the product to the shopping
cart. So, a dynamically created dropdown would be great, but it could also be
done with a dynamically created radiobuttonlist. Ex: color: [here comes dropdown1 with: yellow, green, blue] size: [here comes dropdown2 with: small, medium, large]
It should be an obvious problem as almost all e-commerces offer the
ability to select options for a product.
I really hope someone can help me implement this in asp.NET, or at least tell me where to find a tutorial.
NB: I code in VB.net.
Thanks in advance, Nic
It seems like what you need is a relationship table that's going to link
products with the applicable options. This is more of a SQL question than it
is a .Net framework question.
On the .Net side, the way to go about it is still to use mutliple selects
within a single procedure to generate a DataSet with multiple tables (one for
each option type like size, color).
In your database, I suggest a table tbl_ProductOptions as such:
(I'm using an imaginary schema, but I think you can translate yourself)
CREATE TABLE tbl_ProductOptions (
ProductId int NOT NULL,
OptionId int NOT NULL,
CONSTRAINT PK_ProductOptions PRIMARY KEY(ProductId, OptionId),
<add foreign key constraints here to the products table and the options table>
)
For example, you could have a product identified by ID 1. This product
could then have multiple options associated with it. For example,
1-2
1-5
1-6
Where 2 means a color option, 5 means a size option, and 6 means a shipping
option. You need to create a table to represent the one-to-many relationship
between products and options.
After that, you need a stored procedure to do a select for each option type
that is associated with the product to generate a DataSet with a DataTable
for each option type.
Just my recommendation.
Also,
Keep in mind that the control is not necessarily *generated* dynamically.
It is *populated* dynamically based on the data source that it is bound to.
What you really need to solve is how you plan on creating that data source
(see my previous post).
OK.
I understand and I think I can manage it.
There's just that "generating" vs. "populating" thing:
If on my product webpage I have a product with the options you mensioned:
color, size and shipping for ex.
Than I should have 3 dropdowns on my page. So, how would you say to the
page that there should be 3 dropdowns?
I cannot just put 3 dropdowns on my page and populate it, because sometimes
there will be just 1 dd. or none at all. So that's what I meant with
generating or better "creating" the dropdowns dynamically.
I'm not sure, but maybe I could do this with a placeholder in a reapeater or
something like this...
Hope I'm not taking too much of your time.
THX,
Nic
(ps: leaving now, will be back tomorrow)
"Charles Chen" <Ch*********@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com... Also,
Keep in mind that the control is not necessarily *generated* dynamically.
It is *populated* dynamically based on the data source that it is bound
to. What you really need to solve is how you plan on creating that data source (see my previous post). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: laurie |
last post by:
Hi all,
I'm trying to help out a friend who has inherited a client with a PHP
shopping cart application. Neither of us know PHP, but I've been
muddling my way through, trying to get these old...
|
by: Don Grover |
last post by:
I am retrieving costs and product id's from a sql db. and need to build a
shopping cart around it.
How do I store the selected items and qty req so I can move into another
catalog and total up as...
|
by: OM |
last post by:
I need a simple Javascript shopping cart.
I did a few searches on Yahoo...
And got a few results of free Javascript shopping carts.
The problem is there tooo complicated and very hard to...
|
by: madison |
last post by:
Hi,
I am trying to start a website using paypals shopping cart function.
If i have 10 items and they sell out, how do I make it so the item is
then listed as sold out. The next person would not...
|
by: Jia Sun |
last post by:
hello , everybody , i need a similar program , just like
fancyimport.com
if possible, pls contact me ,thank you very much .
inchina@gmail.com
|
by: isaac2004 |
last post by:
hi i have a basic asp page that acts as an online bookstore. on my cart
page i am having trouble generating 3 numbers; a subtotal, a shipping
total, and a final price. here is my code
i would...
|
by: isaac2004 |
last post by:
hello i am making a spoof online book store site for a class and I was
wondering how i could fix a problem i am having. I have two tables, one
the cart and the other a table with book descriptions....
|
by: John Paul |
last post by:
I'm thinking of building an e-commerce site in php.
Anyone got any advice in building one?
What is the best way to implement a payment system?
Are any legal issues involved?
Thanks,
|
by: samjam |
last post by:
Below is some coding in a program i am using, i would like to know how i can get the text bigger or bolder on my webpage, This is the section of text i would like bigger or bolder (This is a very...
|
by: Paulo |
last post by:
Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart
concept on my application? When the user clicks add item, it will be stored
on some storage format, I dont know what is the...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
| |