Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
OrlandoRocks #1
Container.DataItem in ASCX problem
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 Guest
-
Container.DataItem("field") is null?
I need to check for null values in a datagrid, unless of course there is a better way to do it. I got a field called phone, that I breakdown into a... -
How do you pass a DataBinder.Eval Container.DataItem to a functoin?
I'm trying to pass a value from a data repeater to a function in my code behind page. The value is a decimal that i want to show either in red or... -
ascx... this time the real problem !
You can't use a user control from another domain. If you have a control that needs to be used across domains you'll have to create a server control... -
[ASCX] Add an ascx in a webcontrol...
hey there, ok i made a class, that inherits webcontrol, and i add an htmltable to it. I was wondering how to declare an ascx file as an object in... -
DropDownList in an .ascx file problem.
I have a dropdownlist in an .ascx file. When using the dropdown it is workin 3 or 4 times and suddenly it gives an error like "Control... -



Reply With Quote


