Container.DataItem in ASCX problem

Discussion in 'ASP .Net Datagrid Control' started by OrlandoRocks, Jul 15, 2003.

  1. OrlandoRocks

    OrlandoRocks Guest

    I am trying to use a templated column in a datagrid and having no
    luck, here is the code of both the calling page and the ascx page.

    ..vb

    Dim MyConnection As SqlClient.SqlConnection = New
    SqlClient.SqlConnection("Database=workflow;uid=sa;pwd=newlife")
    Dim custCMD As SqlClient.SqlCommand = New
    SqlClient.SqlCommand("Select * from forma", MyConnection)
    MyConnection.Open()
    Dim myReader As SqlClient.SqlDataReader =
    custCMD.ExecuteReader()
    Dim temp As ITemplate =
    Page.LoadTemplate("webusercontrol4.ascx")
    Dim TemplateColunn As TemplateColumn
    Dim tc As New TemplateColumn
    tc.HeaderText = "Last Name"
    tc.ItemTemplate = temp
    DataGrid1.Columns.Add(tc)
    DataGrid1.DataSource = myReader
    DataGrid1.DataMember = "forma"
    DataGrid1.DataBind()

    ..ascx

    <%@ Control Language="vb" %>
    <asp:Label id=Label1 runat="server" Text='<%#
    DataBinder.Eval(Container.DataItem, "lastname")%>'>
    </asp:Label>

    I get this error message

    BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.

    I know it's probably something simple any ideas?

    Russ
    OrlandoRocks, Jul 15, 2003
    #1
    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. Lauchlan M
    Replies:
    1
    Views:
    7,240
    Lauchlan M
    Oct 15, 2003
  2. Tom Lee
    Replies:
    2
    Views:
    835
    Chris Carter
    Dec 9, 2003
  3. Daniel

    Container.DataItem doubt

    Daniel, Dec 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    380
    Daniel
    Dec 16, 2003
  4. Chumley the Walrus

    Datalist and container.dataitem problem

    Chumley the Walrus, Aug 13, 2004, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    230
    Chumley the Walrus
    Aug 17, 2004
  5. Joe Rattz
    Replies:
    2
    Views:
    599
    Robert Koritnik
    Sep 10, 2004
Loading...

Share This Page