How to pass display property using a variable....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Benjamin Smith

    How to pass display property using a variable....

    I am controlling the display status of a table row using the following code.

    <TR id="CCRow" style="DISPLAY: none">

    Instead of hard coding "none" above, I would like to change that value using
    a hidden input control. How to do that?

    I am getting the error in the following case.

    <TR id="CCRow" style="DISPLAY: "
    'document.frmMy Page.hdnRowDisp layStatus.value '>

    or

    <TR id="CCRow" style="DISPLAY: "
    =document.frmMy Page.hdnRowDisp layStatus.value >

    I am not getting the syntax here what to type.
    I am using IE 5.0+
    Please advice.

    Benjamin







  • darrel

    #2
    Re: How to pass display property using a variable....

    > <TR id="CCRow" style="DISPLAY: "[color=blue]
    > =document.frmMy Page.hdnRowDisp layStatus.value >[/color]

    <TR id="CCRow" style="DISPLAY: <%=yourVariable =>">

    -Darrel


    Comment

    • Eliyahu Goldin

      #3
      Re: How to pass display property using a variable....

      Benjamin,

      An HTML line doesn't get compiled. It is static. You should use javascript
      something like

      CCRow.style.dis play=document.f rmMyPage.hdnRow DisplayStatus.v alue;

      Eliyahu

      "Benjamin Smith" <BenjaminSmith4 5@hotmail.com> wrote in message
      news:eA8RYdJBFH A.1564@TK2MSFTN GP09.phx.gbl...[color=blue]
      > I am controlling the display status of a table row using the following[/color]
      code.[color=blue]
      >
      > <TR id="CCRow" style="DISPLAY: none">
      >
      > Instead of hard coding "none" above, I would like to change that value[/color]
      using[color=blue]
      > a hidden input control. How to do that?
      >
      > I am getting the error in the following case.
      >
      > <TR id="CCRow" style="DISPLAY: "
      > 'document.frmMy Page.hdnRowDisp layStatus.value '>
      >
      > or
      >
      > <TR id="CCRow" style="DISPLAY: "
      > =document.frmMy Page.hdnRowDisp layStatus.value >
      >
      > I am not getting the syntax here what to type.
      > I am using IE 5.0+
      > Please advice.
      >
      > Benjamin
      >
      >
      >
      >
      >
      >
      >[/color]


      Comment

      • Benjamin Smith

        #4
        Re: How to pass display property using a variable....

        Sorry,
        It is not working.
        Thanks,
        Benjamin

        "darrel" <notreal@hotmai l.com> wrote in message
        news:eNTEBjJBFH A.3524@TK2MSFTN GP15.phx.gbl...[color=blue][color=green]
        > > <TR id="CCRow" style="DISPLAY: "
        > > =document.frmMy Page.hdnRowDisp layStatus.value >[/color]
        >
        > <TR id="CCRow" style="DISPLAY: <%=yourVariable =>">
        >
        > -Darrel
        >
        >[/color]


        Comment

        • Benjamin Smith

          #5
          Re: How to pass display property using a variable....

          Still I am getting error when the page is loaded.
          Not sure how to overcome this.
          Thanks for your reply.
          Benjamin

          "Eliyahu Goldin" <removemeegoldi n@monarchmed.co m> wrote in message
          news:umYBFmJBFH A.1400@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Benjamin,
          >
          > An HTML line doesn't get compiled. It is static. You should use javascript
          > something like
          >
          > CCRow.style.dis play=document.f rmMyPage.hdnRow DisplayStatus.v alue;
          >
          > Eliyahu
          >
          > "Benjamin Smith" <BenjaminSmith4 5@hotmail.com> wrote in message
          > news:eA8RYdJBFH A.1564@TK2MSFTN GP09.phx.gbl...[color=green]
          > > I am controlling the display status of a table row using the following[/color]
          > code.[color=green]
          > >
          > > <TR id="CCRow" style="DISPLAY: none">
          > >
          > > Instead of hard coding "none" above, I would like to change that value[/color]
          > using[color=green]
          > > a hidden input control. How to do that?
          > >
          > > I am getting the error in the following case.
          > >
          > > <TR id="CCRow" style="DISPLAY: "
          > > 'document.frmMy Page.hdnRowDisp layStatus.value '>
          > >
          > > or
          > >
          > > <TR id="CCRow" style="DISPLAY: "
          > > =document.frmMy Page.hdnRowDisp layStatus.value >
          > >
          > > I am not getting the syntax here what to type.
          > > I am using IE 5.0+
          > > Please advice.
          > >
          > > Benjamin
          > >
          > >
          > >
          > >
          > >
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Eliyahu Goldin

            #6
            Re: How to pass display property using a variable....

            What error?

            Try document.getEle mentById("CCRow ")

            BTW, I meant an HTML line doesn't get compiled on client side. On server it
            does.

            Eliyahu

            "Benjamin Smith" <BenjaminSmith4 5@hotmail.com> wrote in message
            news:ukgBF1JBFH A.3416@TK2MSFTN GP09.phx.gbl...[color=blue]
            > Still I am getting error when the page is loaded.
            > Not sure how to overcome this.
            > Thanks for your reply.
            > Benjamin
            >
            > "Eliyahu Goldin" <removemeegoldi n@monarchmed.co m> wrote in message
            > news:umYBFmJBFH A.1400@TK2MSFTN GP11.phx.gbl...[color=green]
            > > Benjamin,
            > >
            > > An HTML line doesn't get compiled. It is static. You should use[/color][/color]
            javascript[color=blue][color=green]
            > > something like
            > >
            > > CCRow.style.dis play=document.f rmMyPage.hdnRow DisplayStatus.v alue;
            > >
            > > Eliyahu
            > >
            > > "Benjamin Smith" <BenjaminSmith4 5@hotmail.com> wrote in message
            > > news:eA8RYdJBFH A.1564@TK2MSFTN GP09.phx.gbl...[color=darkred]
            > > > I am controlling the display status of a table row using the following[/color]
            > > code.[color=darkred]
            > > >
            > > > <TR id="CCRow" style="DISPLAY: none">
            > > >
            > > > Instead of hard coding "none" above, I would like to change that value[/color]
            > > using[color=darkred]
            > > > a hidden input control. How to do that?
            > > >
            > > > I am getting the error in the following case.
            > > >
            > > > <TR id="CCRow" style="DISPLAY: "
            > > > 'document.frmMy Page.hdnRowDisp layStatus.value '>
            > > >
            > > > or
            > > >
            > > > <TR id="CCRow" style="DISPLAY: "
            > > > =document.frmMy Page.hdnRowDisp layStatus.value >
            > > >
            > > > I am not getting the syntax here what to type.
            > > > I am using IE 5.0+
            > > > Please advice.
            > > >
            > > > Benjamin
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • darrel

              #7
              Re: How to pass display property using a variable....

              > Sorry,[color=blue]
              > It is not working.[/color]

              Well, you're going to have to give us more information to go on.

              -Darrel


              Comment

              • darrel

                #8
                Re: How to pass display property using a variable....

                > BTW, I meant an HTML line doesn't get compiled on client side. On server
                it[color=blue]
                > does.[/color]

                The HTML is compiled?

                -Darrel


                Comment

                • Eliyahu Goldin

                  #9
                  Re: How to pass display property using a variable....

                  aspx page is. And html, as part of a page, can have server code in it. As
                  you yourself suggested in your post to this thread.

                  Eliyahu

                  "darrel" <notreal@hotmai l.com> wrote in message
                  news:%23grPMIKB FHA.2076@TK2MSF TNGP15.phx.gbl. ..[color=blue][color=green]
                  > > BTW, I meant an HTML line doesn't get compiled on client side. On server[/color]
                  > it[color=green]
                  > > does.[/color]
                  >
                  > The HTML is compiled?
                  >
                  > -Darrel
                  >
                  >[/color]


                  Comment

                  • darrel

                    #10
                    Re: How to pass display property using a variable....

                    > aspx page is. And html, as part of a page, can have server code in it. As[color=blue]
                    > you yourself suggested in your post to this thread.[/color]

                    The server side code is compiled, but I wasn't aware than HTML is compiled.

                    -Darrel


                    Comment

                    • Eliyahu Goldin

                      #11
                      Re: How to pass display property using a variable....

                      Darrel,

                      We are talking about the same thing. The server-side code sitting within
                      html tags is compiled.

                      Eliyahu

                      "darrel" <notreal@hotmai l.com> wrote in message
                      news:%23EPMaUKB FHA.2392@TK2MSF TNGP14.phx.gbl. ..[color=blue][color=green]
                      > > aspx page is. And html, as part of a page, can have server code in it.[/color][/color]
                      As[color=blue][color=green]
                      > > you yourself suggested in your post to this thread.[/color]
                      >
                      > The server side code is compiled, but I wasn't aware than HTML is[/color]
                      compiled.[color=blue]
                      >
                      > -Darrel
                      >
                      >[/color]


                      Comment

                      • Benjamin Smith

                        #12
                        Re: How to pass display property using a variable....

                        OK. Here is the code.
                        Copy and paste this code in the HTML section of the page

                        1. Why I am using hidden varaible here?
                        Currently user can click on hide/show link. If the application is in display
                        mode (I mean the hidden data is displayed) and if the user clicks the
                        button, the post back happens and the user selected display mode will be
                        gone. To avoid that I am trying to keep the user opted mode using hidden
                        control and trying to restore the same value after postback. How to do that?

                        2. Currently this part of my code appears almost at the end of the page
                        where user has clicked vertical scroll bar to get into this section. After
                        scrolling down if the clicks the hide/show link the data will be
                        displayed/hidden but the user will be shown the top of the page. Some thing
                        like my smart navaigation is not effective. I know I am not posting the page
                        back when the user clicks on the hide/show link. But how to restore the
                        vertical postion of the form when the user clicks on hid/show button.

                        Your comments and suggestions are highly appreciated.

                        Benjamin


                        <%@ Page Language="vb" AutoEventWireup ="false" Codebehind="Web Form1.aspx.vb"
                        Inherits="HomeT estApp.WebForm1 "%>
                        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
                        <HTML>
                        <HEAD>
                        <title>WebForm1 </title>
                        <meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
                        <meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
                        <meta name="vs_defaul tClientScript" content="JavaSc ript">
                        <meta name="vs_target Schema"
                        content="http://schemas.microso ft.com/intellisense/ie5">
                        <script language="javas cript">
                        <!--
                        function hideshow(obj)
                        {
                        if (document.getEl ementById(obj). style.display == "block")
                        document.getEle mentById(obj).s tyle.display = "none";
                        else
                        document.getEle mentById(obj).s tyle.display = "block";
                        }
                        //-->
                        </script>
                        </HEAD>
                        <body MS_POSITIONING= "GridLayout ">
                        <form id="Form1" method="post" runat="server">
                        <TABLE width="100%" id="Table1" cellSpacing="1" cellPadding="1"
                        border="1">
                        <tr>
                        <td><a href="#" onclick="hidesh ow('row5')">Hid e Show</a><INPUT
                        type="hidden" id="hdnRowSts" value="none" name="hdnRowSts "></td>
                        </tr>
                        <tr id="row5" style="DISPLAY: none">
                        <TD>
                        <asp:Label id="Label1" runat="server"> Label1</asp:Label></TD>
                        </tr>
                        <tr>
                        <td>
                        <asp:Label id="Label2" runat="server"> Label2</asp:Label>
                        <asp:Button id="btnDoPostBa ck" runat="server"
                        Text="btnDoPost Back"></asp:Button></td>
                        </tr>
                        </TABLE>
                        </form>
                        </body>
                        </HTML>












                        "darrel" <notreal@hotmai l.com> wrote in message
                        news:eDJ$bIKBFH A.2568@TK2MSFTN GP11.phx.gbl...[color=blue][color=green]
                        > > Sorry,
                        > > It is not working.[/color]
                        >
                        > Well, you're going to have to give us more information to go on.
                        >
                        > -Darrel
                        >
                        >[/color]


                        Comment

                        • darrel

                          #13
                          Re: How to pass display property using a variable....

                          > 1. Why I am using hidden varaible here?[color=blue]
                          > Currently user can click on hide/show link. If the application is in[/color]
                          display[color=blue]
                          > mode (I mean the hidden data is displayed) and if the user clicks the
                          > button, the post back happens and the user selected display mode will be
                          > gone. To avoid that I am trying to keep the user opted mode using hidden
                          > control and trying to restore the same value after postback. How to do[/color]
                          that?

                          Is 'display mode' a universal setting, or just for this one page for this
                          one instance? If the former, you probably want to handle that via cookies.
                          And on each page load, read the cookie to determine the 'display mode'.

                          If it's the latter, it'd probably make most sense just to do this all with
                          javascript and forget the postback all together.

                          -Darrel


                          Comment

                          • Benjamin Smith

                            #14
                            Re: How to pass display property using a variable....

                            It is for one page as of now.
                            I can use the cookies to store the user selected mode but how I will restore
                            that status after postback? I am getting the syntax error in my code. Did my
                            code after copy & paste worked? Were you able to regenerate the error that I
                            am getting?
                            Thanks for anwswering my post,Benjamin



                            "darrel" <notreal@hotmai l.com> wrote in message
                            news:u6BxvXXBFH A.3820@TK2MSFTN GP11.phx.gbl...[color=blue][color=green]
                            > > 1. Why I am using hidden varaible here?
                            > > Currently user can click on hide/show link. If the application is in[/color]
                            > display[color=green]
                            > > mode (I mean the hidden data is displayed) and if the user clicks the
                            > > button, the post back happens and the user selected display mode will be
                            > > gone. To avoid that I am trying to keep the user opted mode using hidden
                            > > control and trying to restore the same value after postback. How to do[/color]
                            > that?
                            >
                            > Is 'display mode' a universal setting, or just for this one page for this
                            > one instance? If the former, you probably want to handle that via cookies.
                            > And on each page load, read the cookie to determine the 'display mode'.
                            >
                            > If it's the latter, it'd probably make most sense just to do this all with
                            > javascript and forget the postback all together.
                            >
                            > -Darrel
                            >
                            >[/color]


                            Comment

                            Working...