Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 9th, 2009, 12:59 AM
Authorized User
Points: 106, Level: 2
Points: 106, Level: 2 Points: 106, Level: 2 Points: 106, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Default Multiple category for a product.

how can i assign multiple category for a products when adding products as an admin .
  #2 (permalink)  
Old November 9th, 2009, 12:52 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Hi there,

You need to create a junction table like ProductCategories that keeps track of the IDs of the products and of the categories. Then in the Edit page for a product you can get the categories, bind them to a CheckBoxList, and preselect the ones that were previously selected. On save, you need to clear all records from the junction, and then insert the ones that are selected in the CheckBoxList.

This is just a general overview, but i hope you get the idea.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old November 13th, 2009, 12:24 AM
Authorized User
Points: 106, Level: 2
Points: 106, Level: 2 Points: 106, Level: 2 Points: 106, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Default Not able to preselect

thanks for idea,
but i am not getting my checkbox list preselect
Code:
 while (dr.Read())
        {
            ListItem currentcheckbox = (ListItem)CheckBoxList1.Items.FindByValue(dr["catId"].ToString());
            if (currentcheckbox != null)
            {
                currentcheckbox.Selected = true;

            }
while there is value in dr but list item is always null
  #4 (permalink)  
Old November 13th, 2009, 04:08 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Does the CheckBoxList already contain items at this stage? Maybe you need to call DataBind() on it first?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #5 (permalink)  
Old November 13th, 2009, 08:24 AM
Authorized User
Points: 106, Level: 2
Points: 106, Level: 2 Points: 106, Level: 2 Points: 106, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Default thanks

thanks,
actually i was binding checkboxlist with datasource,which was not working
but bind by code working thanks
 


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dropdownlist with heading for each category debjanib ASP.NET 2.0 Basics 5 May 16th, 2007 05:19 PM
Add category on Blog highspeedwire BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 January 26th, 2007 05:35 PM
Changing Category and/or News order seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 1 March 25th, 2005 01:46 PM
Need help with creating a Parent Category seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 2 November 13th, 2004 06:20 PM
Listing Category then Items harpua Classic ASP Professional 3 December 12th, 2003 11:47 AM



All times are GMT -4. The time now is 01:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.