Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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
Old October 3rd, 2006, 09:47 AM
Friend of Wrox
Join Date: Aug 2006
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Default datalist not displaying...

hi all,

i am trying to display a datalist, corresponding to a catID being passed from page1

problem is that, catID is being passed, but the datalist is not displaying.

<a href =”productsnew.aspx?catID=1 “>furniture</a>

Here I am passing the catID as the parameter

So when the user clicks furniture(corresponding to catID=1), catID=1 get passed, and it should display products which belong to catID= 1

So the productnew.aspx page contains

<script runat="server">

Public sub page_load(sender as object, e as EventArgs)

dim catID as integer = CInt(request.params("catID"))


 'populate list with category products

dim objAC as new ACShopping.ACShop
dim objReader as sqldatareader= objAC.GetCategory(catID)

end sub

// html part of datalist

<asp:DataList ID="dlProducts" RepeatColumns="2" Runat="server" Visible="true">


                                                            <table border="0" width="200" runat = "server" >
                                                                                   <td width="200" valign="center">

                                                                                                <b><%# container.DataItem("ProductName") %></b><br>

  <%# container.DataItem("ProductDesc") %><br>

  <b>Price: </b><%# system.string.format("{0:c}", Container.DataItem("UnitPrice")) %><br>

this is the function in a user defined class called ACShop

Public Function GetCategory(ByVal catID As Integer) As SqlDataReader

             Dim objReader As SqlDataReader

             Dim objcmd As New SqlCommand("spGetCategory", objcon)

            objcmd.CommandType = CommandType.StoredProcedure

             Dim objParam As New SqlParameter("@catID", SqlDbType.Int)

            objParam.Value = catID



                objReader = objcmd.ExecuteReader

            Catch ex As Exception
                Throw ex
            End Try
             Return objReader
        End Function

can anyone see this and say wat is wrong


Old October 3rd, 2006, 10:42 AM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

does this variable contain a value?

dim catID as integer = CInt(request.params("catID"))

You write out the value of Request("catID") but not the value of catID, check to see if it is null

If it is, do this:

Dim catID as Integer = CINT(Request.QueryString("catID"))

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Datalist inside datalist amit.jagtap ASP.NET 2.0 Professional 1 September 4th, 2007 05:03 AM
datalist not displaying.. help me please sarah lee ASP.NET 1.0 and 1.1 Basics 10 August 31st, 2006 07:48 AM
Displaying master/detail relationship in datalist cq_ted ASP.NET 1.x and 2.0 Application Design 0 May 10th, 2006 01:07 AM
DataList in DataList acko ASP.NET 1.0 and 1.1 Professional 3 July 9th, 2004 05:18 PM

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