Title Bar.. Dynamic Data

Discussion in 'ASP .Net' started by Bilal Dhavan, Sep 8, 2004.

  1. Bilal Dhavan

    Bilal Dhavan Guest

    I am using ASP.Net with .Net Framework 1.1.



    I want to display account number in the windows title bar. The data that I
    am going to display will be from server side control (txtAcountNo.text).

    I can use the following statement to display the title.



    <title>

    <% = txtAcountNo.value %>

    </title>



    But the problem is if the user changes the txtAccountNo.text value while
    working with the program it is not getting reflected in the title bar.
    Programming point, I am resubmitting the page to change txtAccountNo.text.

    This approach may be not a good one.

    Any other approach?

    Thanks,

    Bilal
     
    Bilal Dhavan, Sep 8, 2004
    #1
    1. Advertising

  2. Hi Bilal,

    How about using some JavaScript to change the title dynamically?

    Private Sub Page_Load _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    txtAcountNo.Attributes.Add("onblur", _
    "document.title=this.value;")
    End Sub

    <HTML>
    <HEAD>
    <title>

    <% = txtAcountNo.text %>

    </title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="FlowLayout">
    <form id="Form1" method="post" runat="server">
    <P>
    <asp:TextBox id="txtAcountNo" runat="server"></asp:TextBox></P>
    <P>
    <asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
    </form>
    </body>
    </HTML>



    "Bilal Dhavan" <> wrote in message
    news:...
    >I am using ASP.Net with .Net Framework 1.1.
    >
    >
    >
    > I want to display account number in the windows title bar. The data that I
    > am going to display will be from server side control (txtAcountNo.text).
    >
    > I can use the following statement to display the title.
    >
    >
    >
    > <title>
    >
    > <% = txtAcountNo.value %>
    >
    > </title>
    >
    >
    >
    > But the problem is if the user changes the txtAccountNo.text value while
    > working with the program it is not getting reflected in the title bar.
    > Programming point, I am resubmitting the page to change txtAccountNo.text.
    >
    > This approach may be not a good one.
    >
    > Any other approach?
    >
    > Thanks,
    >
    > Bilal
    >
    >
     
    Ken Cox [Microsoft MVP], Sep 9, 2004
    #2
    1. Advertising

  3. "Bilal Dhavan" <> wrote in message news:<>...
    > I am using ASP.Net with .Net Framework 1.1.
    >
    >
    >
    > I want to display account number in the windows title bar. The data that I
    > am going to display will be from server side control (txtAcountNo.text).
    >
    > I can use the following statement to display the title.
    >
    >
    >
    > <title>
    >
    > <% = txtAcountNo.value %>
    >
    > </title>
    >
    >
    >
    > But the problem is if the user changes the txtAccountNo.text value while
    > working with the program it is not getting reflected in the title bar.
    > Programming point, I am resubmitting the page to change txtAccountNo.text.
    >
    > This approach may be not a good one.
    >
    > Any other approach?
    >
    > Thanks,
    >
    > Bilal


    Greeting Billal,

    This is what it should happen since you are not adding any handler
    when user changes value in textbox.

    Two solutions:

    -Add a javascript handler. Choose an event for txtAccountNo from the
    event menu , one could be onblur, then add this snippet code:

    document.title=document.all("txtAccountNo").value


    - Add a server-side event, ServerChange, for txtAccountNo then add
    this snippet:

    Response.write("<script>document.title=document.all("txtAccountNo").value
    </script>")

    Then place html control to enable a server trip so the code above can
    be executed.

    TTH,
    Adel A. Al-saleh
     
    Adel Al-saleh, Sep 9, 2004
    #3
    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. George
    Replies:
    4
    Views:
    513
    George
    Feb 13, 2004
  2. Matt
    Replies:
    0
    Views:
    3,552
  3. John Hann
    Replies:
    0
    Views:
    6,087
    John Hann
    Aug 21, 2004
  4. Matt
    Replies:
    9
    Views:
    70,869
  5. Matt
    Replies:
    9
    Views:
    551
    kaeli
    Aug 23, 2004
Loading...

Share This Page