Newbie, error between asp.net 1.1 and asp.net 2.0

V

verci

Hi guys, sorry if this seems stupid :(

I'm running VS2005 Professional, SQL Server Express 2005, Win XP Pro SP2,
ASP.net 2.0, thanks in advanced for your help.

I trying to migrate an application build on asp.net 1.1 to
asp.net 2.0, I get an error saying:

Public member 'Format' on type 'Date' not found.

for this line in my code
<asp:label text='<%# Container.DataItem.CREATED_DT.Format("G",Nothing) %>'
runat="server" />

Below is the complete aspx form, and i've marked the block of code that i've
issues with.

***************************Forum_view.aspx****************************
<%@ Page Language="VB" MasterPageFile="~/Default.master"
AutoEventWireup="false" CodeFile="Forum_view.aspx.vb" Inherits="Forum_view"
title="Untitled Page" Strict="false" %>

<%@ Register TagPrefix="Club" TagName="AnimationSmall"
Src="Animation_Small.ascx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

<div id="body">

<Club:AnimationSmall ID="Animation1" runat="server" />

<div class="fullwidth">

<asp:label id="forum_name" font-bold="True" font-size="20px" runat="server"
/><hr />

<asp:hyperlink id="post_new" text="Nuevo Mensaje" runat="Server" />

<br /><br />

<asp:hyperlink id="link_previous" text="&lt;&lt;Anterior" runat="server" />

&nbsp;|&nbsp;

<asp:hyperlink id="link_next" text="Siguiente&gt;&gt;" runat="server" /><br
/>

<asp:repeater id="forum_view1" runat="Server">

<HeaderTemplate>

<asp:label font-bold="True" font-size="18px" runat="server" text="Lista de
Temas" /><hr />

</HeaderTemplate>

<Itemtemplate>

*********** can you please show me what would be the correct syntax for this
block of code****************

<asp:hyperlink navigateurl='<%# "message_view.aspx?pid=" &
Container.DataItem.ID & "&fid=" & Request.QueryString("fid") & "&fname=" &
Server.UrlEncode(Request.QueryString("fname")) %>' text='<%#
Container.DataItem.SUBJECT %>' runat="Server" />&nbsp;

(<asp:hyperlink navigateurl='<%# "mailto:" & Container.DataItem.EMAIL%>'
text='<%# Container.DataItem.NICKNAME %>' runat="Server" />)&nbsp;

<asp:label text='<%# Container.DataItem.CREATED_DT.Format("G",Nothing) %>'
runat="server" />

<asp:label text='<%# "(" & Container.DataItem.REPLY_CNT & " responses)" %>'
runat="server" />
*******************************************************************************************
<br />

</Itemtemplate>

<AlternatingItemTemplate>

<asp:panel backcolor="lightskyblue" runat="server">

<asp:hyperlink navigateurl='<%# "message_view.aspx?pid=" &
Container.DataItem.ID & "&fid=" & Request.QueryString("fid") & "&fname=" &
Server.UrlEncode(Request.QueryString("fname")) %>' text='<%#
Container.DataItem.SUBJECT %>' runat="Server" />&nbsp;

(<asp:hyperlink navigateurl='<%# "mailto:" & Container.DataItem.EMAIL%>'
text='<%# Container.DataItem.NICKNAME %>' runat="Server" />)&nbsp;

<asp:label text='<%# Container.DataItem.CREATED_DT.Format("G",Nothing) %>'
runat="server" />

<asp:label text='<%# "(" & Container.DataItem.REPLY_CNT & " responses)" %>'
runat="server" />

</asp:panel>

</AlternatingItemTemplate>

<FooterTemplate>

<hr />

</FooterTemplate>

</asp:repeater>

<asp:hyperlink ID= "back1" navigateurl="Forum_list.aspx" text="Foros
Activos" runat="Server" />

</div>

</div>

</asp:Content>

******************************Code Behind page
Forum_view.aspx.vb********************************

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim ObjCom As SqlCommand

Dim ObjDataReader As SqlDataReader

Dim ObjCon As SqlConnection

Dim myParameter As SqlParameter

Dim dtSubjects As DataTable

Dim fid As String

Dim fname As String

Dim alSubjects As ArrayList

Dim page_size As Integer

Dim start_index As Integer

Dim end_index As Integer

Dim IsNext As Boolean

Dim IsPrevious As Boolean

fid = Request.QueryString("fid")

fname = Request.QueryString("fname")

ObjCon = New
SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString.ToString)

ObjCom = New SqlCommand

ObjCom.CommandText = "sp_get_forum_view" '& Request.QueryString("fid")

ObjCom.CommandType = CommandType.StoredProcedure

ObjCom.Connection = ObjCon

myParameter = ObjCom.CreateParameter()

myParameter.ParameterName = "@Forum_ID"

myParameter.Direction = ParameterDirection.Input

myParameter.SqlDbType = SqlDbType.Int

myParameter.Value = Request.QueryString("fid")

ObjCom.Parameters.Add(myParameter)

ObjCon.Open()

ObjDataReader = ObjCom.ExecuteReader()

dtSubjects = New DataTable("Subjects")

dtSubjects.Load(ObjDataReader)

page_size = 10

If Request.QueryString("si") = "" Then

start_index = 0

Else

start_index = Int32.Parse(Request.QueryString("si"))

End If

end_index = start_index + page_size - 1

Select Case end_index

Case Is < (dtSubjects.Rows.Count - 1)

IsNext = True

Case (dtSubjects.Rows.Count - 1)

IsNext = False

Case Is > (dtSubjects.Rows.Count - 1)

end_index = dtSubjects.Rows.Count - 1

IsNext = False

End Select

If start_index > (page_size - 1) Then

IsPrevious = True

End If

alSubjects = New ArrayList

Dim i As Integer

For i = start_index To end_index

alSubjects.Add(New ForumSubject(dtSubjects.Rows(i)("ID"),
dtSubjects.Rows(i)("CREATED_DT"), dtSubjects.Rows(i)("REPLY_CNT"),
dtSubjects.Rows(i)("NICKNAME"), dtSubjects.Rows(i)("EMAIL"),
dtSubjects.Rows(i)("SUBJECT")))

Next i

'bind the repeater control

forum_view1.DataSource = alSubjects

forum_view1.DataBind()

'set values for other server controls on page

forum_name.Text = "Foro " & Request.QueryString("fname")

post_new.NavigateUrl = "message_post.aspx?fid=" & fid & "&fname=" & fname
''''''''''''''''''''''''' Here is where I call the message_post page a
passed the values´'''''''''''''''''''''''''''''''

If IsPrevious Then

link_previous.NavigateUrl = "forum_view.aspx?fid=" & fid & "&fname=" & fname
& "&si=" & start_index - page_size

End If

If IsNext Then

link_next.NavigateUrl = "forum_view.aspx?fid=" & fid & "&fname=" & fname &
"&si=" & end_index + 1

End If

End Sub
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top