|
-
Oct 27th, 2008, 04:38 AM
#1
Thread Starter
Frenzied Member
[2005] literal control
Hi,
This is supposedly a simple question. Im having my first hands on on Asp.net and Im trying to get the date in the title bar by means of literal control however Im getting errors. The following is my code:
Code:
Sub Page Load()
literal1.text = DateTime.Now.Tostring("D")
End Sub
Now in the source code i put:
Code:
<head>
<title><asp:Literal id="Literal1" runat="server" /></title>
</head>
Error 1
The ID 'Literal1' is already used by another control.
Error 2
Unrecognized tag prefix or device filter 'asp'.
Can someone hep me get started pls.
------------------------------------------------------------------------
If an answer to your question has been helpful, then please, Rate it! 
-
Oct 27th, 2008, 04:46 AM
#2
Re: [2005] literal control
I'm not sure if need to have your head section declared as runat=server using your method however a nicer way IMO is to set the title in code behind, thereby keeping markup and code separate.
Code:
Me.Page.Title = DateTime.Now.Tostring("D")
Last edited by Fishcake; Oct 27th, 2008 at 04:49 AM.
-
Oct 27th, 2008, 07:21 AM
#3
Thread Starter
Frenzied Member
Re: [2005] literal control
hi thanks,
In fact Ive borrowed this book which does everything in a single-file and as a beginner in asp.net its getting me really confused.
Can anyone suggest a good book which uses code-behind and starts from the basics right to the very advanced ?
thanks
------------------------------------------------------------------------
If an answer to your question has been helpful, then please, Rate it! 
-
Oct 27th, 2008, 08:23 AM
#4
Frenzied Member
Re: [2005] literal control
Online Tutorials > Books imo..
There's a nice list of tutorials that Mendhak posted on the top of this forum:
http://www.vbforums.com/showthread.php?t=521851
-
Oct 27th, 2008, 12:03 PM
#5
Re: [2005] literal control
 Originally Posted by angelica
hi thanks,
In fact Ive borrowed this book which does everything in a single-file and as a beginner in asp.net its getting me really confused.
Can anyone suggest a good book which uses code-behind and starts from the basics right to the very advanced ?
thanks
I'm so glad you've noticed that as a flaw! I've been having a somewhat rough day but reading that you want to do it in the codebehind makes the sun shine again and my heart is full of golden joy and happiness!!
Alright, to answer your question - I agree with Besoup. Online tutorials are better. Ask questions here as you go along AND listen to the advice given to you as you go along. You're coming from a windows forms programming background and there's a different way of thinking involved in ASP.NET.
However if you do insist on buying a book, I recommend Wrox Press Professional ASP.NET books.
-
Oct 28th, 2008, 01:02 AM
#6
Thread Starter
Frenzied Member
Re: [2005] literal control
hi Mendak and Besoup,
Thanks for your suggestions.
I shall have a look at the tutorials and would also like to have a book. Do you think it is a good idea to switch to VS 2008 or is it still in its initial beta stage because if it is worthed I might as well buy the book with ASP 3.5 framework.
Mendak. I m sure other agree with you that the code-behind way is better. Was looking at the WRox books and they have just released a book
http://www.amazon.co.uk/gp/product/p...266239&s=books
There's no review yet so has anyone had a look at it please. I need one to start from scratch so that I follow well and it definietely has to be with a code-behind instructions.
If there's a better WRox book for C sharp and vb.net can someone please tell me.
------------------------------------------------------------------------
If an answer to your question has been helpful, then please, Rate it! 
-
Oct 28th, 2008, 09:01 AM
#7
Re: [2005] literal control
If you're starting with ASP.NET, then definitely go for the latest. The .NET 3.5 framework isn't in beta, it's ready for you to use 
The books you've linked to are a little too much for you - it's like jumping into everything at once. What you probably want is either one of these two
http://www.amazon.co.uk/Beginning-AS...ref=pd_sim_b_1
http://www.amazon.co.uk/Professional...5202350&sr=1-1
However, I've never read them so can't tell you much about them.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|