Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Literals

Reply
Thread Tools

Literals

 
 
Guest
Posts: n/a
 
      08-25-2003
Hi,

I am just transfering to asp.net from classic asp. I wish to write out a
"<base href=' & servername & '>" dynaically in the head section of the
form.
I though at first a lieral would do the trick and that i could just set the
text of the lieral (which server I am running on) in the page load event.

however I found that I can't place a lieral in the head in the forms
designer of visual studio and even if I could I guess that I would have to
make the <form> elemants of asp.net surround the literal.

does any body please have a solution to my problem.

any help is appreciated.

cheers

martin.


 
Reply With Quote
 
 
 
 
martin
Guest
Posts: n/a
 
      08-25-2003
Thank you all.


"CT" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hmm, not sure if this will do it for you, but here it goes:
>
> This bit goes in between the head start and end tags:
>
> <base id="serverNameLiteral" href="" runat="server" />
>
> This declaration goes in the class in your code behind file:
>
> protected System.Web.UI.HtmlControls.HtmlGenericControl serverNameLiteral;
>
> This bit goes in the Page_Load event handler in your code behind file:
>
> foreach (System.Web.UI.Control ParentControl in this.Page.Controls)
> {
> if (ParentControl.GetType().ToString() ==
> "System.Web.UI.HtmlControls.HtmlGenericControl ")
> {
> if (ParentControl.ID == "serverNameLiteral")
> {
> serverNameLiteral.Attributes["HREF"] = servername;
> }
> }
> }
>
> I'm sure it can be done much neater, but it might be what you're after.
> --
> Carsten Thomsen
> http://www.apress.com/book/bookDisplay.html?bID=105
> <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi,
> >
> > I am just transfering to asp.net from classic asp. I wish to write

out
> a
> > "<base href=' & servername & '>" dynaically in the head section of the
> > form.
> > I though at first a lieral would do the trick and that i could just set

> the
> > text of the lieral (which server I am running on) in the page load

event.
> >
> > however I found that I can't place a lieral in the head in the forms
> > designer of visual studio and even if I could I guess that I would have

to
> > make the <form> elemants of asp.net surround the literal.
> >
> > does any body please have a solution to my problem.
> >
> > any help is appreciated.
> >
> > cheers
> >
> > martin.
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java: byte literals and short literals John Goche Java 8 01-17-2006 11:12 PM
Visibility of enumeration literals under use clauses biau@altavista.com VHDL 15 02-01-2005 04:19 AM
extract only literals from DataGrid.Item.Cells collection John A Grandy ASP .Net 0 11-22-2004 07:34 AM
literals Al Wilkerson ASP .Net 2 09-25-2004 05:24 AM
Array of literals or better? Duncan Welch ASP .Net 2 07-27-2004 12:36 PM



Advertisments