Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
| Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 20th, 2004, 12:01 PM
Registered User
Join Date: Dec 2004
Location: London, , United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default list box 2 show items according 2 current variable

Hi I need some christmas help please.

I would like my drop down list box to show all items according to a certain foreign key field. The drop down list come's from a table tblSalesItemsCostNotes. The list box is currently displaying all records in this table, but I would like it to display according to the parameter field intSalesItemTypeID.

The tblSalesItemsCostNotes table is structured as follows.

intCostNotesID (PK)
intSalesItemTypeID - parameter I would like to use.
strCostNotes - value(s) that must be displayed in the list box

My stored procedure is as follows and think should be fine.

CREATE PROCEDURE [dbo].[tblSalesItemType_ListBySalesItemTypeID]

 @intSalesItemTypeID int


    tblSalesItemType ON tblSalesItemType.intSalesItemTypeID = tblSalesItemCostnotes.intSalesItemTypeID

 tblSalesItemCostnotes.intSalesItemTypeID = @intSalesItemTypeID

This is my code for the drop down list in file SaleItemEdit.ascx


XXX.BLL.TblSalesItemTypeList costnotes = new XXX.BLL.TblSalesItemTypeList();
this.DropDownSaleItemCostNotes.Items.Add(new ListItem("",""));
reader = types.GetDataReaderBySalesItemTypeID();
while (reader.Read())
this.DropDownSaleItemCostNotes.Items.Add(new ListItem(reader["strCostNotes"].ToString(), reader["intCostNotesID"].ToString()));


code in BLL file TblSalesItemTypeList.cs

public IDataReader GetDataReaderBySalesItemTypeID(int intSalesItemTypeID)
return dal.GetDataReaderBySalesItemTypeID((int)intSalesIt emTypeID);


Code in DAL - TabletblSalesItemType.cs

public IDataReader GetDataReaderBySalesItemTypeID(params object[] parameterValues)
return DataModifier.GetDataReader(this.tableName + "_ListBySalesItemTypeID", parameterValues);

I hope this is not too confusing. Apologees as I am fairly new to ASP.net

thanks in advance

Similar Threads
Thread Thread Starter Forum Replies Last Post
Placing database items into a list box hookenbook Visual Basic 2005 Basics 2 January 14th, 2009 08:56 PM
put mailto: links on list items in a combo box? webwolf Flash (all versions) 0 September 12th, 2008 08:01 AM
adding items to list box using javascript k.manisha ASP.NET 1.0 and 1.1 Professional 3 February 16th, 2007 06:32 AM
Moving Selected Items from a list box to excel AlanAtMars SQL Server 2000 2 August 19th, 2005 02:02 PM
Choosing Multiple Items in a List Box HenryE Access 1 July 25th, 2005 07:14 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.