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
|