need some help with coding

Discussion in 'ASP .Net' started by Milsnips, Oct 17, 2005.

  1. Milsnips

    Milsnips Guest

    hi,

    i've created a page, with a datalist that gets a list of ProductID;s from a
    product table in my database...

    Within the DataList, i have a usercontrol called "ProductDetail.ascx, which
    i put in the <ItemTemplate>. This ascx behind-code, has a public called
    PRODUCT which i want to pass the ProductID from the datalist to the ASCX,
    but im not sure how to reference it here...

    ---------------------
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    If Session.Item("client") Is Nothing Then
    Response.Redirect("../client/login.aspx?url=newProducts.aspx")

    If Not Page.IsPostBack Then

    Dim sql As String = "select top 3 stockID from STOCK"

    Dim dr As SqlClient.SqlDataReader =
    SQLHelper.SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("storeDB"),
    CommandType.Text, sql)

    productSpecials.DataSource = dr

    productSpecials.DataBind()

    End If

    End Sub

    Private Sub productSpecials_ItemDataBound(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DataListItemEventArgs) Handles
    productSpecials.ItemDataBound

    If Not e.Item Is Nothing Then

    Dim dr As System.Data.Common.DbDataRecord = CType(e.Item.DataItem,
    System.Data.Common.DbDataRecord)
    '''here i dont know how to reference the user control, so i can set it the
    PRODUCT variable...????

    End If

    End Sub

    ---------------------

    Any help appreciated,
    Paul
     
    Milsnips, Oct 17, 2005
    #1
    1. Advertising

  2. Milsnips

    Milsnips Guest

    never mind.. problem solved..

    "Milsnips" <> wrote in message
    news:...
    > hi,
    >
    > i've created a page, with a datalist that gets a list of ProductID;s from
    > a product table in my database...
    >
    > Within the DataList, i have a usercontrol called "ProductDetail.ascx,
    > which i put in the <ItemTemplate>. This ascx behind-code, has a public
    > called PRODUCT which i want to pass the ProductID from the datalist to the
    > ASCX, but im not sure how to reference it here...
    >
    > ---------------------
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    >
    > If Session.Item("client") Is Nothing Then
    > Response.Redirect("../client/login.aspx?url=newProducts.aspx")
    >
    > If Not Page.IsPostBack Then
    >
    > Dim sql As String = "select top 3 stockID from STOCK"
    >
    > Dim dr As SqlClient.SqlDataReader =
    > SQLHelper.SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("storeDB"),
    > CommandType.Text, sql)
    >
    > productSpecials.DataSource = dr
    >
    > productSpecials.DataBind()
    >
    > End If
    >
    > End Sub
    >
    > Private Sub productSpecials_ItemDataBound(ByVal sender As Object, ByVal e
    > As System.Web.UI.WebControls.DataListItemEventArgs) Handles
    > productSpecials.ItemDataBound
    >
    > If Not e.Item Is Nothing Then
    >
    > Dim dr As System.Data.Common.DbDataRecord = CType(e.Item.DataItem,
    > System.Data.Common.DbDataRecord)
    > '''here i dont know how to reference the user control, so i can set it the
    > PRODUCT variable...????
    >
    > End If
    >
    > End Sub
    >
    > ---------------------
    >
    > Any help appreciated,
    > Paul
    >
     
    Milsnips, Oct 17, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brendan Duffy
    Replies:
    0
    Views:
    4,694
    Brendan Duffy
    Jul 25, 2003
  2. Guest
    Replies:
    0
    Views:
    687
    Guest
    Feb 25, 2004
  3. mx2k

    Need some simple coding help

    mx2k, Mar 1, 2005, in forum: Python
    Replies:
    7
    Views:
    304
  4. calmar
    Replies:
    11
    Views:
    909
    calmar
    Feb 21, 2006
  5. Domino
    Replies:
    5
    Views:
    391
    dorayme
    Nov 5, 2006
Loading...

Share This Page