ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Populating DropDownList control dynamically in DataGrid

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#)
View previous topic :: View next topic  
Author Message
mumick



Joined: 18 Apr 2005
Posts: 1
Location: Milwaukee, WI

PostPosted: Mon Apr 18, 2005 3:26 pm    Post subject: Populating DropDownList control dynamically in DataGrid Reply with quote

Hi there,

Q: I have a page with multiple datagrids. Each datagrid represents a separate category of products, I have Hardware, Software, Parts and End of Life categories. For each datagrid I have three columns: ProductID, Description and Select (it's a template column containing checkboxes). After user makes a selection of products from different datagrids, I store them in a hashtable by its ProductID value (its a unique identifier for each product). Then after user hits submit button he gets transferred to the different page where program has to populate all the products he chose. Here is a piece of code I use to build a query string which is on a first page:
Code:
sb.AppendFormat(" SELECT TOP 1 p.ProductID, p.Identifier, p.ListPrice, " & _
" p.ContractPrice, p.Discount, p.InstallEach, " & _
" ISNULL(s.ServiceLevel, 'N/A') as ServiceLevel " & _
" FROM Products p " & _
" LEFT OUTER JOIN ServicePlan s ON p.ProductID=s.ProductID " & _
" WHERE p.ProductID='{0}' " & _
" UNION ", entry.Key)
sb.Remove((sb.Length - 6), 6)
sb.Append(" ORDER BY p.Identifier DESC ")

It loops through key-value pairs in hashtable and creates a query string. The thing is I can populate all the fields except for the dropdownlist control which should contain ServiceLevel in it. First of all each product can have multiple service levels, that's why in a first code fragment I select top 1 because I don't need the other records with the same ProductID but I do need all service levels which go with this particular product. Any thoughts on it. I really need a good advice. Thanks in advance, mumick.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial