Problem by postback

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ZohrehF
    New Member
    • Apr 2008
    • 3

    Problem by postback

    Hello,

    In my ASP.Net project, after posback , the title of page is gone. In Page_Load I have used of
    Page.Header.Con trols.Add(new LiteralControl( @"<title>Sel ect document</title>"));

    But it get the title only for first time and after posback there is no title.
    Please tell me what I have to do.

    Zohreh
  • Stang02GT
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    Unfortunatly this is not the right thread for ASP.NET questions. Please PM a site moderator and ask them to move your post to the correct forum.

    Please look around before posting to make sure that you post in the right forum. Saves the MODS time/pain of moving your thread and it will help you get a better answer.


    Please Read posting guidelines as well.

    Comment

    • ZohrehF
      New Member
      • Apr 2008
      • 3

      #3
      Problem by postback

      Hello,

      In my ASP.Net project, I have used of Modal dialog page. Everything is ok but after posback , the title of page is gone.
      In Page_Load I have used of :
      Code:
      Page.Header.Controls.Add(new LiteralControl(@"<title>Select </title>"));
      The first time is good en then there is no title.
      Please tell me what I have to do.

      Regards
      Zohreh

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by ZohrehF
        Hello,

        In my ASP.Net project, I have used of Modal dialog page. Everything is ok but after posback , the title of page is gone.
        In Page_Load I have used of :
        Code:
        Page.Header.Controls.Add(new LiteralControl(@"<title>Select </title>"));
        The first time is good en then there is no title.
        Please tell me what I have to do.

        Regards
        Zohreh
        Please post your Page_Load code.
        I have a feeling that you are adding the header to the hpage if it's the first time posting back only....


        Why don't you just add the title directly to your HTML instead of doing it dynamically?

        -Frinny

        Comment

        • ZohrehF
          New Member
          • Apr 2008
          • 3

          #5
          Originally posted by Frinavale
          Please post your Page_Load code.
          I have a feeling that you are adding the header to the hpage if it's the first time posting back only....


          Why don't you just add the title directly to your HTML instead of doing it dynamically?

          -Frinny
          [QUOTE=zohrehf]Hello,I explain from beginning:
          I am using modal dialog box page Select.aspx(Pag e title is Start case ) in my asp.net project. In that dialog box page, I have a grid view control with enabled paging.

          When the Modaldialogbox page is loaded it showing the Title as "Start case --WebDialog Box". It is fine. But

          When ever i go to next page by clicking gridview paging, The title is disappearing but showing only "webDialogB ox".

          I want persistant title same as "Start case WebDialog Box" when ever i go to next page in the gridview.

          I added the title directly to the HTML , but i am facing the same problem.

          The code of Page_Load is:


          Code:
          protected void Page_Load(object sender, EventArgs e)
          {
          Page.Header.Controls.Add(new LiteralControl(@"<base target=""_self"" />")); 
          Page.Header.Controls.Add(new LiteralControl(@"<title>Start case  </title>")); 
          if (!IsPostBack) 
          {}
          }
          Thank you
          Zohreh

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by ZohrehF
            ...


            Code:
            protected void Page_Load(object sender, EventArgs e)
            {
            Page.Header.Controls.Add(new LiteralControl(@"<base target=""_self"" />")); 
            Page.Header.Controls.Add(new LiteralControl(@"<title>Start case  </title>")); 
            if (!IsPostBack) 
            {}
            }
            Thank you
            Zohreh
            Maybe more than one title tag is being rendered in the browser and it is unable to display it properly?

            View the code once the page has been rendered and check for more than one <title> tag (right click on the page and select View Source).

            I still don't know why you don't just physically add the title to the page...

            EG: in your ASP page Source View...
            [code=asp]
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
            <html xmlns="http://www.w3.org/1999/xhtml" >
            <head Id="Head1" runat="server">
            <title>Put your title here????</title>
            <link href="StyleShee t.css" rel="stylesheet " type="text/css" />
            <link rel="icon" href="myIcon.ic o" type="image/x-icon" />
            </head>
            <body>
            <!-- .............-->
            [/code]

            -Frinny

            Comment

            Working...