switching between HTML and ASPNET

Discussion in 'ASP .Net' started by =?Utf-8?B?S2VubnkgTS4=?=, Apr 28, 2006.

  1. Hi

    I want to write de content of a variable from my asp net code into the Title
    Bar of the Browser

    each time I need to switch between those world (HTML-ASPNET) I suffer cause
    I don’t have clear the boundaries in between

    What alternatives do I have?
    Where Can I find a good documentation about using or switching between HTML
    and ASPNET, passing data, controlling html controls. etc

    Thks
     
    =?Utf-8?B?S2VubnkgTS4=?=, Apr 28, 2006
    #1
    1. Advertising

  2. If you set runat="server" in any HTML tag you can set it's properties in
    server side code referencing it by ID. However you can do what you need to
    do simply using the following in the Page_load event handler.

    string PageTitle = "My Page";
    Page.Title = PageTitle;

    "Kenny M." wrote:

    > Hi
    >
    > I want to write de content of a variable from my asp net code into the Title
    > Bar of the Browser
    >
    > each time I need to switch between those world (HTML-ASPNET) I suffer cause
    > I don’t have clear the boundaries in between
    >
    > What alternatives do I have?
    > Where Can I find a good documentation about using or switching between HTML
    > and ASPNET, passing data, controlling html controls. etc
    >
    > Thks
    >
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Apr 28, 2006
    #2
    1. Advertising

  3. Hi

    Thanks for your answer but the first thing I did was looking for Title
    property and there is not such property in the Page object, at lease I can
    not find it..

    I'm working in VB.NET

    also I know that I can convert HTML controls to server controls, but how do
    you manage sections like <HEAD><TITLE>?.


    thks
    --
    Kenny M.



    --
    Kenny M.


    "clickon" wrote:

    > If you set runat="server" in any HTML tag you can set it's properties in
    > server side code referencing it by ID. However you can do what you need to
    > do simply using the following in the Page_load event handler.
    >
    > string PageTitle = "My Page";
    > Page.Title = PageTitle;
    >
    > "Kenny M." wrote:
    >
    > > Hi
    > >
    > > I want to write de content of a variable from my asp net code into the Title
    > > Bar of the Browser
    > >
    > > each time I need to switch between those world (HTML-ASPNET) I suffer cause
    > > I don’t have clear the boundaries in between
    > >
    > > What alternatives do I have?
    > > Where Can I find a good documentation about using or switching between HTML
    > > and ASPNET, passing data, controlling html controls. etc
    > >
    > > Thks
    > >
     
    =?Utf-8?B?S2VubnkgTS4=?=, Apr 28, 2006
    #3
  4. I started with ASP.net 2.0 in which the page object has a title property,
    maybe it doesn't in 1.1

    To handle any HTML tag simply set runat="server" and give it an ID, then you
    can set it's properties programatically via server side code.

    e.g.

    <head runat="server" id="myHead">

    You can then set the title with MyHead.Title = "MyTitle";

    As i say i have never used asp.net 1.1 so if this doesn't work for you maybe
    it's time to upgrade.

    "Kenny M." wrote:

    > Hi
    >
    > Thanks for your answer but the first thing I did was looking for Title
    > property and there is not such property in the Page object, at lease I can
    > not find it..
    >
    > I'm working in VB.NET
    >
    > also I know that I can convert HTML controls to server controls, but how do
    > you manage sections like <HEAD><TITLE>?.
    >
    >
    > thks
    > --
    > Kenny M.
    >
    >
    >
    > --
    > Kenny M.
    >
    >
    > "clickon" wrote:
    >
    > > If you set runat="server" in any HTML tag you can set it's properties in
    > > server side code referencing it by ID. However you can do what you need to
    > > do simply using the following in the Page_load event handler.
    > >
    > > string PageTitle = "My Page";
    > > Page.Title = PageTitle;
    > >
    > > "Kenny M." wrote:
    > >
    > > > Hi
    > > >
    > > > I want to write de content of a variable from my asp net code into the Title
    > > > Bar of the Browser
    > > >
    > > > each time I need to switch between those world (HTML-ASPNET) I suffer cause
    > > > I don’t have clear the boundaries in between
    > > >
    > > > What alternatives do I have?
    > > > Where Can I find a good documentation about using or switching between HTML
    > > > and ASPNET, passing data, controlling html controls. etc
    > > >
    > > > Thks
    > > >
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Apr 28, 2006
    #4
  5. Ok that works

    I’m still looking for ways to work more directly between ASPNET and HTML
    without convert, I remember something like <@# > to include asp controls
    into the HTML etc, but I can find a tutorial so if you have one pass it to me.

    I can not migrate because the company does not want to do it yet :/ anyway
    thks.
    --
    Kenny M.



    "clickon" wrote:

    > I started with ASP.net 2.0 in which the page object has a title property,
    > maybe it doesn't in 1.1
    >
    > To handle any HTML tag simply set runat="server" and give it an ID, then you
    > can set it's properties programatically via server side code.
    >
    > e.g.
    >
    > <head runat="server" id="myHead">
    >
    > You can then set the title with MyHead.Title = "MyTitle";
    >
    > As i say i have never used asp.net 1.1 so if this doesn't work for you maybe
    > it's time to upgrade.
    >
    > "Kenny M." wrote:
    >
    > > Hi
    > >
    > > Thanks for your answer but the first thing I did was looking for Title
    > > property and there is not such property in the Page object, at lease I can
    > > not find it..
    > >
    > > I'm working in VB.NET
    > >
    > > also I know that I can convert HTML controls to server controls, but how do
    > > you manage sections like <HEAD><TITLE>?.
    > >
    > >
    > > thks
    > > --
    > > Kenny M.
    > >
    > >
    > >
    > > --
    > > Kenny M.
    > >
    > >
    > > "clickon" wrote:
    > >
    > > > If you set runat="server" in any HTML tag you can set it's properties in
    > > > server side code referencing it by ID. However you can do what you need to
    > > > do simply using the following in the Page_load event handler.
    > > >
    > > > string PageTitle = "My Page";
    > > > Page.Title = PageTitle;
    > > >
    > > > "Kenny M." wrote:
    > > >
    > > > > Hi
    > > > >
    > > > > I want to write de content of a variable from my asp net code into the Title
    > > > > Bar of the Browser
    > > > >
    > > > > each time I need to switch between those world (HTML-ASPNET) I suffer cause
    > > > > I don’t have clear the boundaries in between
    > > > >
    > > > > What alternatives do I have?
    > > > > Where Can I find a good documentation about using or switching between HTML
    > > > > and ASPNET, passing data, controlling html controls. etc
    > > > >
    > > > > Thks
    > > > >
     
    =?Utf-8?B?S2VubnkgTS4=?=, Apr 28, 2006
    #5
  6. Putting code within the HTML is the old, bad, classic ASP way of doing
    things. ASP.net is object and event driven. So in short, apart from a
    couple of exceptions such as binding things to controls in TemplateFields,
    you do not do things the way you are suggesting, ASP.net it is simply not
    designed that way. This is a good thing. The ASP.net way of doing things is
    much better, and leads to much easier to understand, cleaner and more stable
    code, that is much much easier to maintain in the long run.


    "Kenny M." wrote:

    > Ok that works
    >
    > I’m still looking for ways to work more directly between ASPNET and HTML
    > without convert, I remember something like <@# > to include asp controls
    > into the HTML etc, but I can find a tutorial so if you have one pass it to me.
    >
    > I can not migrate because the company does not want to do it yet :/ anyway
    > thks.
    > --
    > Kenny M.
    >
    >
    >
    > "clickon" wrote:
    >
    > > I started with ASP.net 2.0 in which the page object has a title property,
    > > maybe it doesn't in 1.1
    > >
    > > To handle any HTML tag simply set runat="server" and give it an ID, then you
    > > can set it's properties programatically via server side code.
    > >
    > > e.g.
    > >
    > > <head runat="server" id="myHead">
    > >
    > > You can then set the title with MyHead.Title = "MyTitle";
    > >
    > > As i say i have never used asp.net 1.1 so if this doesn't work for you maybe
    > > it's time to upgrade.
    > >
    > > "Kenny M." wrote:
    > >
    > > > Hi
    > > >
    > > > Thanks for your answer but the first thing I did was looking for Title
    > > > property and there is not such property in the Page object, at lease I can
    > > > not find it..
    > > >
    > > > I'm working in VB.NET
    > > >
    > > > also I know that I can convert HTML controls to server controls, but how do
    > > > you manage sections like <HEAD><TITLE>?.
    > > >
    > > >
    > > > thks
    > > > --
    > > > Kenny M.
    > > >
    > > >
    > > >
    > > > --
    > > > Kenny M.
    > > >
    > > >
    > > > "clickon" wrote:
    > > >
    > > > > If you set runat="server" in any HTML tag you can set it's properties in
    > > > > server side code referencing it by ID. However you can do what you need to
    > > > > do simply using the following in the Page_load event handler.
    > > > >
    > > > > string PageTitle = "My Page";
    > > > > Page.Title = PageTitle;
    > > > >
    > > > > "Kenny M." wrote:
    > > > >
    > > > > > Hi
    > > > > >
    > > > > > I want to write de content of a variable from my asp net code into the Title
    > > > > > Bar of the Browser
    > > > > >
    > > > > > each time I need to switch between those world (HTML-ASPNET) I suffer cause
    > > > > > I don’t have clear the boundaries in between
    > > > > >
    > > > > > What alternatives do I have?
    > > > > > Where Can I find a good documentation about using or switching between HTML
    > > > > > and ASPNET, passing data, controlling html controls. etc
    > > > > >
    > > > > > Thks
    > > > > >
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Apr 28, 2006
    #6
  7. Definitely you are right , some time I forget the philosophy of ASP.NET

    thks

    anyway talking about the same issue, when you set the runat and id words in
    htmlcontrols those controls are recognized in .net code windows but for items
    like HTML , TITLE or HEAD even you can set perfectly the attributes ASP1.1
    does not recognized those elements in code.


    --
    Kenny M.


    "clickon" wrote:

    > Putting code within the HTML is the old, bad, classic ASP way of doing
    > things. ASP.net is object and event driven. So in short, apart from a
    > couple of exceptions such as binding things to controls in TemplateFields,
    > you do not do things the way you are suggesting, ASP.net it is simply not
    > designed that way. This is a good thing. The ASP.net way of doing things is
    > much better, and leads to much easier to understand, cleaner and more stable
    > code, that is much much easier to maintain in the long run.
    >
    >
    > "Kenny M." wrote:
    >
    > > Ok that works
    > >
    > > I’m still looking for ways to work more directly between ASPNET and HTML
    > > without convert, I remember something like <@# > to include asp controls
    > > into the HTML etc, but I can find a tutorial so if you have one pass it to me.
    > >
    > > I can not migrate because the company does not want to do it yet :/ anyway
    > > thks.
    > > --
    > > Kenny M.
    > >
    > >
    > >
    > > "clickon" wrote:
    > >
    > > > I started with ASP.net 2.0 in which the page object has a title property,
    > > > maybe it doesn't in 1.1
    > > >
    > > > To handle any HTML tag simply set runat="server" and give it an ID, then you
    > > > can set it's properties programatically via server side code.
    > > >
    > > > e.g.
    > > >
    > > > <head runat="server" id="myHead">
    > > >
    > > > You can then set the title with MyHead.Title = "MyTitle";
    > > >
    > > > As i say i have never used asp.net 1.1 so if this doesn't work for you maybe
    > > > it's time to upgrade.
    > > >
    > > > "Kenny M." wrote:
    > > >
    > > > > Hi
    > > > >
    > > > > Thanks for your answer but the first thing I did was looking for Title
    > > > > property and there is not such property in the Page object, at lease I can
    > > > > not find it..
    > > > >
    > > > > I'm working in VB.NET
    > > > >
    > > > > also I know that I can convert HTML controls to server controls, but how do
    > > > > you manage sections like <HEAD><TITLE>?.
    > > > >
    > > > >
    > > > > thks
    > > > > --
    > > > > Kenny M.
    > > > >
    > > > >
    > > > >
    > > > > --
    > > > > Kenny M.
    > > > >
    > > > >
    > > > > "clickon" wrote:
    > > > >
    > > > > > If you set runat="server" in any HTML tag you can set it's properties in
    > > > > > server side code referencing it by ID. However you can do what you need to
    > > > > > do simply using the following in the Page_load event handler.
    > > > > >
    > > > > > string PageTitle = "My Page";
    > > > > > Page.Title = PageTitle;
    > > > > >
    > > > > > "Kenny M." wrote:
    > > > > >
    > > > > > > Hi
    > > > > > >
    > > > > > > I want to write de content of a variable from my asp net code into the Title
    > > > > > > Bar of the Browser
    > > > > > >
    > > > > > > each time I need to switch between those world (HTML-ASPNET) I suffer cause
    > > > > > > I don’t have clear the boundaries in between
    > > > > > >
    > > > > > > What alternatives do I have?
    > > > > > > Where Can I find a good documentation about using or switching between HTML
    > > > > > > and ASPNET, passing data, controlling html controls. etc
    > > > > > >
    > > > > > > Thks
    > > > > > >
     
    =?Utf-8?B?S2VubnkgTS4=?=, Apr 28, 2006
    #7
  8. =?Utf-8?B?S2VubnkgTS4=?=

    Mark Rae Guest

    "Kenny M." <> wrote in message
    news:...

    > anyway talking about the same issue, when you set the runat and id words
    > in
    > htmlcontrols those controls are recognized in .net code windows but for
    > items
    > like HTML , TITLE or HEAD even you can set perfectly the attributes
    > ASP1.1
    > does not recognized those elements in code.


    On your ASPX page...

    <html>
    <head>
    <title><asp:Label ID=lblTitle Runat=server /></title>
    </head>

    <body>

    </body>
    </html>

    On your class page...

    protected Label lblTitle;

    lblTitle.Text = "This is my page title";
     
    Mark Rae, Apr 29, 2006
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bobrics
    Replies:
    5
    Views:
    2,527
    bobrics
    Mar 7, 2005
  2. Jerry III

    Re: Switching Between HTTP and HTTPS

    Jerry III, Oct 15, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    936
    Jerry III
    Oct 15, 2003
  3. Rasool
    Replies:
    6
    Views:
    864
  4. Replies:
    7
    Views:
    655
    Juan T. Llibre
    Mar 23, 2007
  5. nano2k
    Replies:
    1
    Views:
    230
    nano2k
    Jun 27, 2007
Loading...

Share This Page