Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 October 3rd, 2006, 09:47 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: norcross, Ga, USA.
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"))

Response.Write(Request("catID"))

 'populate list with category products

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

     dlproducts.datasource=objAC.GetCategory(catID)
dlProducts.databind()
objReader.Close()
end sub

// html part of datalist

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

                                              <ItemTemplate>

                                                            <table border="0" width="200" runat = "server" >
                                                                        <tr>
                                                                                   <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

            objcmd.Parameters.Add(objParam)

            Try
                objcon.Open()

                objReader = objcmd.ExecuteReader

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


can anyone see this and say wat is wrong

thanks





  #2 (permalink)  
Old October 3rd, 2006, 10:42 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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.
 


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
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



All times are GMT -4. The time now is 05:25 PM.


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