HighTechTalks DotNet Forums  

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

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Newbie, error between asp.net 1.1 and asp.net 2.0 in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
verci
 
Posts: n/a

Default Newbie, error between asp.net 1.1 and asp.net 2.0 - 02-08-2007 , 03:14 AM






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>

<aspanel 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" />

</aspanel>

</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.ConfigurationMa nager.ConnectionStrings("ClubSiteDB").ConnectionSt ring.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



Reply With Quote
  #2  
Old   
Teemu Keiski
 
Posts: n/a

Default Re: Newbie, error between asp.net 1.1 and asp.net 2.0 - 02-12-2007 , 10:48 AM






Sounds like you'd be migrating to the web site project model which is
significantly different from the project model in VS2003.
Migration would be easier if you'd migrate to VS2005 Web Application Project

see:
http://www.eps-publishing.com/Article.aspx?quickid=0609061 (esp page 6)

http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx


--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net


"verci" <iodataser (AT) yahoo (DOT) com> wrote

Quote:
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>>" 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

aspanel 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" /

/aspanel

/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.ConfigurationMa nager.ConnectionStrings("ClubSiteDB").ConnectionSt ring.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




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.