473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.frmMyPage.hdnRowDisplayStatus.value'>

or

<TR id="CCRow" style="DISPLAY:"
=document.frmMyPage.hdnRowDisplayStatus.value>

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

Benjamin



Nov 19 '05 #1
13 1943
> <TR id="CCRow" style="DISPLAY:"
=document.frmMyPage.hdnRowDisplayStatus.value>


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

-Darrel
Nov 19 '05 #2
Benjamin,

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

CCRow.style.display=document.frmMyPage.hdnRowDispl ayStatus.value;

Eliyahu

"Benjamin Smith" <Be*************@hotmail.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
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.frmMyPage.hdnRowDisplayStatus.value'>

or

<TR id="CCRow" style="DISPLAY:"
=document.frmMyPage.hdnRowDisplayStatus.value>

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

Benjamin


Nov 19 '05 #3
Sorry,
It is not working.
Thanks,
Benjamin

"darrel" <no*****@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP15.phx.gbl...
<TR id="CCRow" style="DISPLAY:"
=document.frmMyPage.hdnRowDisplayStatus.value>


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

-Darrel

Nov 19 '05 #4
Still I am getting error when the page is loaded.
Not sure how to overcome this.
Thanks for your reply.
Benjamin

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Benjamin,

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

CCRow.style.display=document.frmMyPage.hdnRowDispl ayStatus.value;

Eliyahu

"Benjamin Smith" <Be*************@hotmail.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
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.frmMyPage.hdnRowDisplayStatus.value'>

or

<TR id="CCRow" style="DISPLAY:"
=document.frmMyPage.hdnRowDisplayStatus.value>

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

Benjamin



Nov 19 '05 #5
What error?

Try document.getElementById("CCRow")

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

Eliyahu

"Benjamin Smith" <Be*************@hotmail.com> wrote in message
news:uk**************@TK2MSFTNGP09.phx.gbl...
Still I am getting error when the page is loaded.
Not sure how to overcome this.
Thanks for your reply.
Benjamin

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Benjamin,

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

CCRow.style.display=document.frmMyPage.hdnRowDispl ayStatus.value;

Eliyahu

"Benjamin Smith" <Be*************@hotmail.com> wrote in message
news:eA**************@TK2MSFTNGP09.phx.gbl...
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.frmMyPage.hdnRowDisplayStatus.value'>

or

<TR id="CCRow" style="DISPLAY:"
=document.frmMyPage.hdnRowDisplayStatus.value>

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

Benjamin




Nov 19 '05 #6
> Sorry,
It is not working.


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

-Darrel
Nov 19 '05 #7
> BTW, I meant an HTML line doesn't get compiled on client side. On server
it
does.


The HTML is compiled?

-Darrel
Nov 19 '05 #8
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" <no*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
BTW, I meant an HTML line doesn't get compiled on client side. On server

it
does.


The HTML is compiled?

-Darrel

Nov 19 '05 #9
> 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.


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

-Darrel
Nov 19 '05 #10
Darrel,

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

Eliyahu

"darrel" <no*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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.
The server side code is compiled, but I wasn't aware than HTML is

compiled.
-Darrel

Nov 19 '05 #11
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="WebForm1.aspx.vb"
Inherits="HomeTestApp.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</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">
<script language="javascript">
<!--
function hideshow(obj)
{
if (document.getElementById(obj).style.display == "block")
document.getElementById(obj).style.display = "none";
else
document.getElementById(obj).style.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="hideshow('row5')">Hide 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="btnDoPostBack" runat="server"
Text="btnDoPostBack"></asp:Button></td>
</tr>
</TABLE>
</form>
</body>
</HTML>




"darrel" <no*****@hotmail.com> wrote in message
news:eD**************@TK2MSFTNGP11.phx.gbl...
Sorry,
It is not working.


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

-Darrel

Nov 19 '05 #12
> 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?

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
Nov 19 '05 #13
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" <no*****@hotmail.com> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...
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?

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

Nov 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: carmen | last post by:
I am using the code below to open another page depending on what is selected. This is working ok but I would like to streamline it so that I will hot have to create a page everytime a new category...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
8
by: darrel | last post by:
I'm still trying to fully understand how best to pass variables between pages/usercontrols/each other. On a current site I've done, I've had one userControl do the logic and set the variable,...
3
by: ILCSP | last post by:
Hello, I'm fairly new to the concept of running action pass through queries (insert, update, etc.) from Access 2000. I have a SQL Server 2000 database and I'm using a Access 2K database as my...
10
by: John Bailo | last post by:
I want to pass a SqlCommand object as a input parameter to a method. I want to pass the SqlCommand "by value" so that any updates to the original object are *not* reflected in the object within...
4
by: simon | last post by:
hello. relatively new to vb.net, i'm using VS 2003 and .net 2.0 i have a web app that i'm i have a user control that displays a simple 1 row table as the header of the page. the user control...
14
by: =?Utf-8?B?Umljaw==?= | last post by:
I have seen examples of passing data from FormB to FormA (Parent To Child) but I need an example of passind data from FormA to FormB. My main form is FormA; I will enter some data in textboxes and...
13
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.