Title Properties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Groh

    Title Properties

    Maybe someone knows how to "fix" this question!
    I need to send this to the <title><%=objTi tulo.TituloPagi na;%></title>
    This does not work, How can i send my object.properti e value to the title
    tag ? I didn't find any property Title in WebForm1 class!

    Thanks in advance!

    Daniel


  • CSharper

    #2
    Re: Title Properties


    Perhaps not the most efficient way, but this should work fine (at least in
    IE).
    this.RegisterCl ientScriptBlock ("someName","<s cript>document. title='Hello
    World';</script>");

    Hope this helps,

    Dan Cox
    DISCLAIMER: This may not be the best way to handle this, but it should work.

    "Daniel Groh" <newsgroupms@gm ail.com> wrote in message
    news:Og3NmL6SFH A.2128@TK2MSFTN GP15.phx.gbl...[color=blue]
    > Maybe someone knows how to "fix" this question!
    > I need to send this to the <title><%=objTi tulo.TituloPagi na;%></title>
    > This does not work, How can i send my object.properti e value to the title
    > tag ? I didn't find any property Title in WebForm1 class!
    >
    > Thanks in advance!
    >
    > Daniel
    >[/color]


    Comment

    • Daniel Groh

      #3
      Re: Title Properties

      thats a C# and not a Jscript u know ?
      objTitulo.Titul oPagina <- this comes from my ASCX

      How do I apply objTitulo.Titul oPagina (C#) into a <script></script> ???

      Thanks in advance

      "CSharper" <dont@botherme. com> escreveu na mensagem
      news:1bZbe.1386 89$vL3.117941@b ignews4.bellsou th.net...[color=blue]
      >
      > Perhaps not the most efficient way, but this should work fine (at least in
      > IE).
      > this.RegisterCl ientScriptBlock ("someName","<s cript>document. title='Hello
      > World';</script>");
      >
      > Hope this helps,
      >
      > Dan Cox
      > DISCLAIMER: This may not be the best way to handle this, but it should
      > work.
      >
      > "Daniel Groh" <newsgroupms@gm ail.com> wrote in message
      > news:Og3NmL6SFH A.2128@TK2MSFTN GP15.phx.gbl...[color=green]
      >> Maybe someone knows how to "fix" this question!
      >> I need to send this to the <title><%=objTi tulo.TituloPagi na;%></title>
      >> This does not work, How can i send my object.properti e value to the title
      >> tag ? I didn't find any property Title in WebForm1 class!
      >>
      >> Thanks in advance!
      >>
      >> Daniel
      >>[/color]
      >
      >[/color]


      Comment

      • CSharper

        #4
        Re: Title Properties

        OK, so then there's essentially 2 options that shine out at me in this
        little amount of time.
        1. In the Page_Load event of the .aspx page holding the .ascx, you run:
        this.RegisterCl ientScriptBlock ("someName","<s cript>document. title='"
        + objTitulo.Titul oPagina + "';</script>");

        or

        2. In the user control (.ascx), you can add an <asp:Literal runat=server
        id=myLiteral> and set it's value, like so:
        myLiteral.Text = "<script>docume nt.title='" + objTitulo.Titul oPagina +
        "';</script>";

        Hope this helps,
        Dan Cox
        DISCLAIMER: I haven't tested either approach.

        "Daniel Groh" <newsgroupms@gm ail.com> wrote in message
        news:e2OPSq6SFH A.3332@TK2MSFTN GP15.phx.gbl...[color=blue]
        > thats a C# and not a Jscript u know ?
        > objTitulo.Titul oPagina <- this comes from my ASCX
        >
        > How do I apply objTitulo.Titul oPagina (C#) into a <script></script> ???
        >
        > Thanks in advance
        >
        > "CSharper" <dont@botherme. com> escreveu na mensagem
        > news:1bZbe.1386 89$vL3.117941@b ignews4.bellsou th.net...[color=green]
        >>
        >> Perhaps not the most efficient way, but this should work fine (at least
        >> in IE).
        >> this.RegisterCl ientScriptBlock ("someName","<s cript>document. title='Hello
        >> World';</script>");
        >>
        >> Hope this helps,
        >>
        >> Dan Cox
        >> DISCLAIMER: This may not be the best way to handle this, but it should
        >> work.
        >>
        >> "Daniel Groh" <newsgroupms@gm ail.com> wrote in message
        >> news:Og3NmL6SFH A.2128@TK2MSFTN GP15.phx.gbl...[color=darkred]
        >>> Maybe someone knows how to "fix" this question!
        >>> I need to send this to the <title><%=objTi tulo.TituloPagi na;%></title>
        >>> This does not work, How can i send my object.properti e value to the
        >>> title tag ? I didn't find any property Title in WebForm1 class!
        >>>
        >>> Thanks in advance!
        >>>
        >>> Daniel
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Dave

          #5
          Re: Title Properties

          I believe that the <%=objTitulo.Ti tuloPagina;%> will still work in ASP.NET.

          1. Make sure that the <title></title> tag is not contained by (nested in) any tags with runat="server".
          2. Make sure that "objTitulo" is in the scope of the ASPX page. This means that it must be declared in your code-behind with no
          less access than "public" or "protected" , and must be an instance or static variable on the class-level.
          3. Make sure that "objTitulo" is intialized in the contructor of the ASPX page.

          That should do it.

          --
          Dave Sexton
          dave@www..jwaon line..com
          -----------------------------------------------------------------------
          "Daniel Groh" <newsgroupms@gm ail.com> wrote in message news:Og3NmL6SFH A.2128@TK2MSFTN GP15.phx.gbl...[color=blue]
          > Maybe someone knows how to "fix" this question!
          > I need to send this to the <title><%=objTi tulo.TituloPagi na;%></title>
          > This does not work, How can i send my object.properti e value to the title tag ? I didn't find any property Title in WebForm1
          > class!
          >
          > Thanks in advance!
          >
          > Daniel
          >[/color]


          Comment

          • Steve Walker

            #6
            Re: Title Properties

            In message <Lv_be.139098$v L3.86292@bignew s4.bellsouth.ne t>, CSharper
            <dont@botherme. com> writes[color=blue]
            >OK, so then there's essentially 2 options that shine out at me in this
            >little amount of time.
            >1. In the Page_Load event of the .aspx page holding the .ascx, you run:
            > this.RegisterCl ientScriptBlock ("someName","<s cript>document. title='"
            >+ objTitulo.Titul oPagina + "';</script>");
            >
            >or
            >
            >2. In the user control (.ascx), you can add an <asp:Literal runat=server
            >id=myLiteral > and set it's value, like so:
            > myLiteral.Text = "<script>docume nt.title='" + objTitulo.Titul oPagina +
            >"';</script>";[/color]

            3. Create a custom control which overrides Render to emit the title
            html.

            I've got something a bit like this for dynamically emitting stylesheet
            declarations.

            --
            Steve Walker

            Comment

            • mortb

              #7
              Re: Title Properties

              You could always do this which should be the asp.net way:

              aspx page:

              <title id="_title" runat="server"> old title</title>

              in codebehing/inline code:

              HtmlGenericCont rol _title;
              protected void page_load( ... )
              {
              _title.InnerHtm l = "new title";
              }

              beware:
              There is a bug in visual studio (at least in VS.NET 2002) that [id="_title"
              runat="server"]
              is stripped from the title tag when opening the aspx page in design view

              cheers,
              mortb

              "Daniel Groh" <newsgroupms@gm ail.com> wrote in message
              news:Og3NmL6SFH A.2128@TK2MSFTN GP15.phx.gbl...[color=blue]
              > Maybe someone knows how to "fix" this question!
              > I need to send this to the <title><%=objTi tulo.TituloPagi na;%></title>
              > This does not work, How can i send my object.properti e value to the title
              > tag ? I didn't find any property Title in WebForm1 class!
              >
              > Thanks in advance!
              >
              > Daniel
              >[/color]


              Comment

              • Daniel Groh

                #8
                Re: Title Properties

                I got this

                ---------------------------
                Microsoft Internet Explorer
                ---------------------------
                Unable to find script library
                '/aspnet_client/system_web/1_1_4322/WebUIValidation .js'. Try placing this
                file manually, or reinstall by running 'aspnet_regiis -c'.
                ---------------------------
                OK
                ---------------------------

                trying to use that:

                this.RegisterCl ientScriptBlock ("someName","<s cript>document. title='"+
                objTitulo.Titul oPagina + "';</script>");

                Something else ? Maybe a customcontrol is the solution, but this really
                doesn't make me happy... =/

                Thank u all

                Daniel


                "Steve Walker" <steve@otolith. demon.co.uk> escreveu na mensagem
                news:QgriJiJ5$K cCFwT1@otolith. demon.co.uk...[color=blue]
                > In message <Lv_be.139098$v L3.86292@bignew s4.bellsouth.ne t>, CSharper
                > <dont@botherme. com> writes[color=green]
                >>OK, so then there's essentially 2 options that shine out at me in this
                >>little amount of time.
                >>1. In the Page_Load event of the .aspx page holding the .ascx, you run:
                >>
                >> this.RegisterCl ientScriptBlock ("someName","<s cript>document. title='"
                >>+ objTitulo.Titul oPagina + "';</script>");
                >>
                >>or
                >>
                >>2. In the user control (.ascx), you can add an <asp:Literal runat=server
                >>id=myLitera l> and set it's value, like so:
                >> myLiteral.Text = "<script>docume nt.title='" + objTitulo.Titul oPagina +
                >>"';</script>";[/color]
                >
                > 3. Create a custom control which overrides Render to emit the title html.
                >
                > I've got something a bit like this for dynamically emitting stylesheet
                > declarations.
                >
                > --
                > Steve Walker[/color]


                Comment

                • Daniel Groh

                  #9
                  Re: Title Properties

                  Greate Man, solved mortb! =D

                  But now a curiosity...her e at work is running the code this.RegisterCl ientScriptBlock ("Au","<script> document.title= 'teste';</script>");

                  at home it does not work, i got a message error:

                  Unable to find script library
                  '/aspnet_client/system_web/1_1_4322/WebUIValidation .js'. Try placing this
                  file manually, or reinstall by running 'aspnet_regiis -c'.

                  What culd it be ?

                  --
                  Daniel Groh
                  CTF Technologies do Brasil LTDA
                  Analista Programador
                  Fone: 11 3837-4203
                  Email: dgroh@ctf.com.b r

                  "mortb" <mortb1<noospam <@hotmail.com > escreveu na mensagem news:%23axgid9S FHA.3556@TK2MSF TNGP10.phx.gbl. ..[color=blue]
                  > You could always do this which should be the asp.net way:
                  >
                  > aspx page:
                  >
                  > <title id="_title" runat="server"> old title</title>
                  >
                  > in codebehing/inline code:
                  >
                  > HtmlGenericCont rol _title;
                  > protected void page_load( ... )
                  > {
                  > _title.InnerHtm l = "new title";
                  > }
                  >
                  > beware:
                  > There is a bug in visual studio (at least in VS.NET 2002) that [id="_title"
                  > runat="server"]
                  > is stripped from the title tag when opening the aspx page in design view
                  >
                  > cheers,
                  > mortb
                  >
                  > "Daniel Groh" <newsgroupms@gm ail.com> wrote in message
                  > news:Og3NmL6SFH A.2128@TK2MSFTN GP15.phx.gbl...[color=green]
                  >> Maybe someone knows how to "fix" this question!
                  >> I need to send this to the <title><%=objTi tulo.TituloPagi na;%></title>
                  >> This does not work, How can i send my object.properti e value to the title
                  >> tag ? I didn't find any property Title in WebForm1 class!
                  >>
                  >> Thanks in advance!
                  >>
                  >> Daniel
                  >> [/color]
                  >
                  >[/color]

                  Comment

                  Working...