Grid Template...

flolcatrord

New Member
Hi,<BR><BR>I made a page that connects and displays from a dbase using the "default" view.<BR><BR>I am trying to add a template, but am getting error. The simple template i defined is as follows:<BR><BR><columns><BR><asp:TemplateColumn HeaderText="Show"><BR><ItemTemplate><BR><asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "fprogram") %>'/><BR></ItemTemplate><BR></asp:TemplateColumn><BR></columns><BR><BR>The error message I recieve is: <BR><BR>error BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.<BR><BR>I have imported 2 namespaces: <BR><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><BR>I appreciate any help.<BR><BR>thanksGive me the Page_load() event code.<BR>do you use DataAdapter or DataReader?<BR>give me a sample of your code.<BR>thank you.<BR><BR>sooryaHere is my Sub code:<BR><BR> Sub Page_Load(Source as Object, E as EventArgs)<BR> Dim strConn as String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:Inetpubdatabasesepisodics.mdb"<BR><BR> Dim strSQL as string = "SELECT fdate, ftime, tblEpisodic.fprogram, ftitle, fsynopsis from tblSchedule, tblEpisodic WHERE fdate = #9/1/01# AND tblSchedule.fepisode = tblEpisodic.fepisode ORDER by ftime "<BR><BR> Dim schedConn as New OleDbConnection(strConn)<BR> Dim SQLcmd as New OLeDbCommand(strSQL, schedConn)<BR> schedConn.Open()<BR> SchedDataGrid.DataSource = SQLcmd.ExecuteReader(System.Data.CommandBehavior.C loseConnection)<BR> SchedDataGrid.DataBind()<BR> End Sub<BR><BR>I tried using a dataadapter like this before:<BR><BR>Sub Page_Load(Source as Object, E as EventArgs)<BR> Dim strConn as String<BR> strConn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:Inetpubdatabasesepisodics.mdb"<BR> Dim schedConn as OleDbConnection<BR> schedConn = New OleDbConnection(strConnString)<BR> schedConn.Open()<BR> Dim objCmdSelect as New OleDbCommand("SELECT fdate, ftime, tblEpisodic.fprogram, ftitle, fsynopsis from tblSchedule, tblEpisodic WHERE fdate = #9/1/01# AND tblSchedule.fepisode = tblEpisodic.fepisode ORDER by ftime ", schedConn)<BR> Dim objAdapter1 As New OleDbDataAdapter()<BR> objAdapter1.SelectCommand = objCmdSelect<BR> Dim objDataset1 As New DataSet()<BR> objAdapter1.Fill(objDataset1, "Sched")<BR> DataGrid1.DataSource = objDataset1.Tables(0).DefaultView<BR> DataGrid1.DataBind()<BR> schedConn.Close()<BR> End Sub<BR><BR>Thanks in advance!Still getting same error!
 
Back
Top