473,725 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Control Access from Javascript

Hi all,

I have a user control that uses control literal to build
a heading with a link, and a div containing links below.

As the link heading is hit, I want to change the style of
the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse
(Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a
client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error
I have also tried document.all.wh ichElement

none of them seem to be able to locate the DIV.

/*
<HEAD>
<title>DefaultP age</title>
<meta content="Micros oft Visual
Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript"
name="vs_defaul tClientScript">
<meta
content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="IntranetS tyleSheet.css"
type="text/css" rel="stylesheet ">
</HEAD>
<body bottomMargin="0 " topMargin="10">
<form name="Form1" method="post"
action="Default .aspx" id="Form1">
<input type="hidden" name="__VIEWSTA TE"
value="dDwtODk2 MzgzMTIzO3Q8O2w 8aTwxPjs+O2w8dD w7bDxpPDE+Oz4
7bDx0PHA8cDxsPF BhZ2VJbmRleDtPd GhlckxpbmtzO090 aGVyTGlua3NVc
mxzO0ltYWdlTGlu a0xlZnRJbWFnZVV ybDtJbWFnZUxpbm tMZWZ0VmlzaWJ
sZTtVc2VyUGFnZX M7PjtsPGk8MD47Q DxDb250ZW50O01h aW50LlBhZ2U7R
GVsZXRlIFBhZ2U7 PjtAPENvbnRlbnQ uYXNweD9QYWdlSW 5kZXg9MDtNYWl
udFBhZ2UuYXNweD 9QYWdlSW5kZXg9M DtEZWxldGVQYWdl LmFzcHg/UGFnZ
UluZGV4PTA7Pjsu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZztvPHQ+O0B
UQ1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GJt UnRiMlIxYkdWekV ISnBaMmgwYUdGdV pHMXZaSFZzWlh
NQkFBWUdDQUlBQU FBR0F3QUFBQVpRW VdkbElESFFCd0FB Q1FRQUFBQUpCU
UFBQUJFRUFBQUFB UUFBQUFZR0FBQUF BQkVGQUFBQUFRQU FBQWtHQUFBQUN
3PT0+Oz47Pj47Pj tsPGk8MT47aTwzP jtpPDU+Oz47bDx0 PHA8cDxsPEltY
WdlVXJsOz47bDwu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZzs+Pjs+Ozs
+O3Q8cDxwPGw8Vm lzaWJsZTs+O2w8b zxmPjs+Pjs+Ozs+ O3Q8cDxwPGw8V
mlzaWJsZTs+O2w8 bzxmPjs+Pjs+Ozs +Oz4+Oz4+Oz4+Oz 4VjdJyQDGO4uo
/blpMHMc/AvRcPg==" />

<P>
<TABLE id="Table2" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD noWrap><a
id="PageHeaderC ontrol_ImageLin kLeft"><img
src="images/trinity_logo.jp g" border="0" /></a></TD>
<TD noWrap align="center"> </TD>
<TD noWrap align="right"></TD>
</TR>
<tr>
<td height="5"></td>
</tr>
</TABLE>
<TABLE id="Table1" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD id="PageHeaderC ontrol_tblcellP ages"
align="left" width="1%"><tab le cellspacing="0"
cellpadding="5" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="ActivePa ge" nowrap="nowrap"
align="Center"> <a class="PageLink " href="default.a spx?
PageIndex=0">Ho me</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="PageLink "
href="default.a spx?PageIndex=1 ">Page 1</a></td>
</tr>
</table></TD>

<TD class="Inactive Page"
width="98%">&nb sp;</TD>
<TD id="PageHeaderC ontrol_tblcellM aint"
align="right">< table cellspacing="0" cellpadding="5"
align="Right" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="Inactive Page" nowrap="nowrap"
align="Center"> <a class="MaintLin k" href="Content.a spx?
PageIndex=0">Co ntent</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="MaintLin k"
href="MaintPage .aspx?PageIndex =0">Maint.Pag e</a></td><td
class="Inactive Page" nowrap="nowrap" align="Center"> <a
class="MaintLin k" href="DeletePag e.aspx?
PageIndex=0">De lete Page</a></td>
</tr>
</table></TD>

</TR>
<TR>
<TD class="PagerBac kground" colSpan="2"
height="4"></TD>
<TD class="PagerBac kground"
height="4"></TD>
</TR>
</TABLE>
</P>
<P>

<LINK href="../../IntranetStyleSh eet.css" type="text/css"
rel="stylesheet ">
<TABLE class="Dialogue " id="Table1" cellSpacing="0"
cellPadding="10 " width="100%" border="0">
<TR>
<TD class="PagerBac kground" style="FONT-
WEIGHT: bold" align="center" height="20">Fav ourite
Links</TD>
<TD class="PagerBac kground" align="right"
width="2%" height="20"><in put type="submit"
name="Links1:bt nClose" value="X" id="Links1_btnC lose"
class="CloseBut ton" style="height:0 px;width:20px;" /></TD>
</TR>
<TR>
<TD id=" " colspan="2"><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse()'>< IMG src='images/plus.jpg'
alt='Expand/Collapse Node' border='0'
height='10'></a>&nbsp;Persona l</h5><DIV title = 'Yeh
right!' style=' display: none; ID='Personal'>< LI style='
FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial;
LIST-STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR:
blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink1</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink2</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink3</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink4</LI></DIV><h5 STYLE='COLOR:bl ue'><a
STYLE='CURSOR: hand;' onclick='DoExpa ndCollapse()'>< IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a>&nbsp;Test</h5><DIV title
= 'Yeh right!' style=' display: none; ID='Test'><LI
style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link3</LI></TD>

</TR>
<TR>
<TD class="Pagerbac kground" align="right"
height="20"></TD>
<TD class="Pagerbac kground" noWrap
align="right" width="2%" height="20"><a
id="Links1_Hype rLink1">Maintai n Links</a></TD>
</TR>
</TABLE>
<script language="javas cript">
<!--
function DoExpandCollaps e()
{
alert(document. all.Personal);
/* alert(whichElem ent.id);
alert(whichElem ent.style.displ ay);
whichElement.st yle.display =
(whichElement.s tyle.display)?" ":"none";*/
}
//-->
</script>
<INPUT id="mybutton" type="button" value="Button">
</P>
</form>
</body>
*/
Any help would be appreciated.... .Pete
Nov 18 '05 #1
11 4998
Hi Pete,

You'll need to use the getElementById( ) javascript function. In your client
script block:

function Doexpandcollaps e(whichElement)
{
getElementById( whichElement).s tyle.display=
(getElementById (whichElement). style.display=" none")?" ":"none";
}

-- Alex Papadimoulis

"trinitypet e" <su*****@trinit y.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
Hi all,

I have a user control that uses control literal to build
a heading with a link, and a div containing links below.

As the link heading is hit, I want to change the style of
the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse
(Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a
client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error
I have also tried document.all.wh ichElement
[snip]

Nov 18 '05 #2
I just had the same problem. Check the generated HTML (View Source) and you
will see that the name of the user control is prepended to the ID. You will
have to find the control with the name UC:Element.

Lloyd Sheen

"trinitypet e" <su*****@trinit y.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
Hi all,

I have a user control that uses control literal to build
a heading with a link, and a div containing links below.

As the link heading is hit, I want to change the style of
the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse
(Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a
client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error
I have also tried document.all.wh ichElement

none of them seem to be able to locate the DIV.

/*
<HEAD>
<title>DefaultP age</title>
<meta content="Micros oft Visual
Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript"
name="vs_defaul tClientScript">
<meta
content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="IntranetS tyleSheet.css"
type="text/css" rel="stylesheet ">
</HEAD>
<body bottomMargin="0 " topMargin="10">
<form name="Form1" method="post"
action="Default .aspx" id="Form1">
<input type="hidden" name="__VIEWSTA TE"
value="dDwtODk2 MzgzMTIzO3Q8O2w 8aTwxPjs+O2w8dD w7bDxpPDE+Oz4
7bDx0PHA8cDxsPF BhZ2VJbmRleDtPd GhlckxpbmtzO090 aGVyTGlua3NVc
mxzO0ltYWdlTGlu a0xlZnRJbWFnZVV ybDtJbWFnZUxpbm tMZWZ0VmlzaWJ
sZTtVc2VyUGFnZX M7PjtsPGk8MD47Q DxDb250ZW50O01h aW50LlBhZ2U7R
GVsZXRlIFBhZ2U7 PjtAPENvbnRlbnQ uYXNweD9QYWdlSW 5kZXg9MDtNYWl
udFBhZ2UuYXNweD 9QYWdlSW5kZXg9M DtEZWxldGVQYWdl LmFzcHg/UGFnZ
UluZGV4PTA7Pjsu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZztvPHQ+O0B
UQ1MuQXBwbGljYX Rpb25zLk5ldC50Y 3NJbnRyYW5ldFBv cnRhbC5JbnRyY
W5ldFBhZ2UsIHRj c0ludHJhbmV0Q2x hc3NlcywgVmVyc2 lvbj0xLjAuMC4
wLCBDdW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QUFZR0FBQUF BQkVGQUFBQUFRQU FBQWtHQUFBQUN
3PT0+Oz47Pj47Pj tsPGk8MT47aTwzP jtpPDU+Oz47bDx0 PHA8cDxsPEltY
WdlVXJsOz47bDwu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZzs+Pjs+Ozs
+O3Q8cDxwPGw8Vm lzaWJsZTs+O2w8b zxmPjs+Pjs+Ozs+ O3Q8cDxwPGw8V
mlzaWJsZTs+O2w8 bzxmPjs+Pjs+Ozs +Oz4+Oz4+Oz4+Oz 4VjdJyQDGO4uo
/blpMHMc/AvRcPg==" />

<P>
<TABLE id="Table2" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD noWrap><a
id="PageHeaderC ontrol_ImageLin kLeft"><img
src="images/trinity_logo.jp g" border="0" /></a></TD>
<TD noWrap align="center"> </TD>
<TD noWrap align="right"></TD>
</TR>
<tr>
<td height="5"></td>
</tr>
</TABLE>
<TABLE id="Table1" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD id="PageHeaderC ontrol_tblcellP ages"
align="left" width="1%"><tab le cellspacing="0"
cellpadding="5" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="ActivePa ge" nowrap="nowrap"
align="Center"> <a class="PageLink " href="default.a spx?
PageIndex=0">Ho me</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="PageLink "
href="default.a spx?PageIndex=1 ">Page 1</a></td>
</tr>
</table></TD>

<TD class="Inactive Page"
width="98%">&nb sp;</TD>
<TD id="PageHeaderC ontrol_tblcellM aint"
align="right">< table cellspacing="0" cellpadding="5"
align="Right" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="Inactive Page" nowrap="nowrap"
align="Center"> <a class="MaintLin k" href="Content.a spx?
PageIndex=0">Co ntent</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="MaintLin k"
href="MaintPage .aspx?PageIndex =0">Maint.Pag e</a></td><td
class="Inactive Page" nowrap="nowrap" align="Center"> <a
class="MaintLin k" href="DeletePag e.aspx?
PageIndex=0">De lete Page</a></td>
</tr>
</table></TD>

</TR>
<TR>
<TD class="PagerBac kground" colSpan="2"
height="4"></TD>
<TD class="PagerBac kground"
height="4"></TD>
</TR>
</TABLE>
</P>
<P>

<LINK href="../../IntranetStyleSh eet.css" type="text/css"
rel="stylesheet ">
<TABLE class="Dialogue " id="Table1" cellSpacing="0"
cellPadding="10 " width="100%" border="0">
<TR>
<TD class="PagerBac kground" style="FONT-
WEIGHT: bold" align="center" height="20">Fav ourite
Links</TD>
<TD class="PagerBac kground" align="right"
width="2%" height="20"><in put type="submit"
name="Links1:bt nClose" value="X" id="Links1_btnC lose"
class="CloseBut ton" style="height:0 px;width:20px;" /></TD>
</TR>
<TR>
<TD id=" " colspan="2"><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse()'>< IMG src='images/plus.jpg'
alt='Expand/Collapse Node' border='0'
height='10'></a>&nbsp;Persona l</h5><DIV title = 'Yeh
right!' style=' display: none; ID='Personal'>< LI style='
FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial;
LIST-STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR:
blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink1</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink2</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink3</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink4</LI></DIV><h5 STYLE='COLOR:bl ue'><a
STYLE='CURSOR: hand;' onclick='DoExpa ndCollapse()'>< IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a>&nbsp;Test</h5><DIV title
= 'Yeh right!' style=' display: none; ID='Test'><LI
style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link3</LI></TD>

</TR>
<TR>
<TD class="Pagerbac kground" align="right"
height="20"></TD>
<TD class="Pagerbac kground" noWrap
align="right" width="2%" height="20"><a
id="Links1_Hype rLink1">Maintai n Links</a></TD>
</TR>
</TABLE>
<script language="javas cript">
<!--
function DoExpandCollaps e()
{
alert(document. all.Personal);
/* alert(whichElem ent.id);
alert(whichElem ent.style.displ ay);
whichElement.st yle.display =
(whichElement.s tyle.display)?" ":"none";*/
}
//-->
</script>
<INPUT id="mybutton" type="button" value="Button">
</P>
</form>
</body>
*/
Any help would be appreciated.... .Pete

Nov 18 '05 #3
Pete,

Another thing to note is that the ID on the server will often vary on the
client.

You may need to pass to your clientside javascript function the Client ID of
the Div: Personal.Client ID

-- Alex Papadimoulis
"trinitypet e" <su*****@trinit y.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
Hi all,

I have a user control that uses control literal to build
a heading with a link, and a div containing links below.

As the link heading is hit, I want to change the style of
the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse
(Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a
client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error
I have also tried document.all.wh ichElement

none of them seem to be able to locate the DIV.

/*
<HEAD>
<title>DefaultP age</title>
<meta content="Micros oft Visual
Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript"
name="vs_defaul tClientScript">
<meta
content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="IntranetS tyleSheet.css"
type="text/css" rel="stylesheet ">
</HEAD>
<body bottomMargin="0 " topMargin="10">
<form name="Form1" method="post"
action="Default .aspx" id="Form1">
<input type="hidden" name="__VIEWSTA TE"
value="dDwtODk2 MzgzMTIzO3Q8O2w 8aTwxPjs+O2w8dD w7bDxpPDE+Oz4
7bDx0PHA8cDxsPF B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x BQUVBQUFELy8vLy 9BUUFBQUFBQUF
BQU1BZ0FBQUVsMF kzTkpiblJ5WVc1b GRFTnNZWE56WlhN c0lGWmxjbk5wY
jI0OU1TNHdMakF1 TUN3Z1EzVnNkSFZ 5WlQxdVpYVjBjbU ZzTENCUWRXSnN
hV05MWlhsVWIydG xiajF1ZFd4c0JRR UFBQUF6VkVOVExr RndjR3hwWTJGM
GFXOXVjeTVPWlhR dWRHTnpTVzUwY21 GdVpYUlFiM0owWV d3dVNXNTBjbUZ
1WlhSUVlXZGxCQU FBQUFad1lXZGxhV 1FPYzJWeGRXVnVZ MlZ1ZFcxaVpYS
VBiR1ZtZEdoaGJt UnRiMlIxYkdWekV ISnBaMmgwYUdGdV pHMXZaSFZzWlh
NQkFBWUdDQUlBQU FBR0F3QUFBQVpRW VdkbElESFFCd0FB Q1FRQUFBQUpCU
UFBQUJFRUFBQUFB UUFBQUFZR0FBQUF BQkVGQUFBQUFRQU FBQWtHQUFBQUN
3PT0+Oz47Pj47Pj tsPGk8MT47aTwzP jtpPDU+Oz47bDx0 PHA8cDxsPEltY
WdlVXJsOz47bDwu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZzs+Pjs+Ozs
+O3Q8cDxwPGw8Vm lzaWJsZTs+O2w8b zxmPjs+Pjs+Ozs+ O3Q8cDxwPGw8V
mlzaWJsZTs+O2w8 bzxmPjs+Pjs+Ozs +Oz4+Oz4+Oz4+Oz 4VjdJyQDGO4uo
/blpMHMc/AvRcPg==" />

<P>
<TABLE id="Table2" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD noWrap><a
id="PageHeaderC ontrol_ImageLin kLeft"><img
src="images/trinity_logo.jp g" border="0" /></a></TD>
<TD noWrap align="center"> </TD>
<TD noWrap align="right"></TD>
</TR>
<tr>
<td height="5"></td>
</tr>
</TABLE>
<TABLE id="Table1" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD id="PageHeaderC ontrol_tblcellP ages"
align="left" width="1%"><tab le cellspacing="0"
cellpadding="5" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="ActivePa ge" nowrap="nowrap"
align="Center"> <a class="PageLink " href="default.a spx?
PageIndex=0">Ho me</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="PageLink "
href="default.a spx?PageIndex=1 ">Page 1</a></td>
</tr>
</table></TD>

<TD class="Inactive Page"
width="98%">&nb sp;</TD>
<TD id="PageHeaderC ontrol_tblcellM aint"
align="right">< table cellspacing="0" cellpadding="5"
align="Right" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="Inactive Page" nowrap="nowrap"
align="Center"> <a class="MaintLin k" href="Content.a spx?
PageIndex=0">Co ntent</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="MaintLin k"
href="MaintPage .aspx?PageIndex =0">Maint.Pag e</a></td><td
class="Inactive Page" nowrap="nowrap" align="Center"> <a
class="MaintLin k" href="DeletePag e.aspx?
PageIndex=0">De lete Page</a></td>
</tr>
</table></TD>

</TR>
<TR>
<TD class="PagerBac kground" colSpan="2"
height="4"></TD>
<TD class="PagerBac kground"
height="4"></TD>
</TR>
</TABLE>
</P>
<P>

<LINK href="../../IntranetStyleSh eet.css" type="text/css"
rel="stylesheet ">
<TABLE class="Dialogue " id="Table1" cellSpacing="0"
cellPadding="10 " width="100%" border="0">
<TR>
<TD class="PagerBac kground" style="FONT-
WEIGHT: bold" align="center" height="20">Fav ourite
Links</TD>
<TD class="PagerBac kground" align="right"
width="2%" height="20"><in put type="submit"
name="Links1:bt nClose" value="X" id="Links1_btnC lose"
class="CloseBut ton" style="height:0 px;width:20px;" /></TD>
</TR>
<TR>
<TD id=" " colspan="2"><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse()'>< IMG src='images/plus.jpg'
alt='Expand/Collapse Node' border='0'
height='10'></a>&nbsp;Persona l</h5><DIV title = 'Yeh
right!' style=' display: none; ID='Personal'>< LI style='
FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial;
LIST-STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR:
blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink1</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink2</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink3</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink4</LI></DIV><h5 STYLE='COLOR:bl ue'><a
STYLE='CURSOR: hand;' onclick='DoExpa ndCollapse()'>< IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a>&nbsp;Test</h5><DIV title
= 'Yeh right!' style=' display: none; ID='Test'><LI
style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link3</LI></TD>

</TR>
<TR>
<TD class="Pagerbac kground" align="right"
height="20"></TD>
<TD class="Pagerbac kground" noWrap
align="right" width="2%" height="20"><a
id="Links1_Hype rLink1">Maintai n Links</a></TD>
</TR>
</TABLE>
<script language="javas cript">
<!--
function DoExpandCollaps e()
{
alert(document. all.Personal);
/* alert(whichElem ent.id);
alert(whichElem ent.style.displ ay);
whichElement.st yle.display =
(whichElement.s tyle.display)?" ":"none";*/
}
//-->
</script>
<INPUT id="mybutton" type="button" value="Button">
</P>
</form>
</body>
*/
Any help would be appreciated.... .Pete

Nov 18 '05 #4
Hi all,

Thanks for the replies. I'm still having the problem.

Looking at the rendered HTML the DIV has definately got
the ID of Personal and has not been prefixed with the
user control. With regard to using the client ID, I
thought this would only be for controls where the ID is
generated by ASP.NET (HTML included below).

I have also tried the getElementById in the client script
block. Here is the script as rendered at runtime.

As the function executes I get the message Personal is
undefined.

/*
<SCRIPT LANGUAGE=javasc ript>function ExpandCollapse
(whichElement){ a=document.getE lementById(whic hElement);}
</SCRIPT>
*/

Heres the HTML:

/*
<TD id="Links1_tblC ellContent"
colspan="2"><h5 STYLE='COLOR:bl ue'><a STYLE='CURSOR:
hand;' onclick='DoExpa ndCollapse(Pers onal)'><IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a>&nbsp;Persona l</h5><DIV
style=' display: none; ID=Personal><LI style=' FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink1</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink2</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink3</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink4</LI></DIV><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse(Test )'><IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a>&nbsp;Test</h5><DIV style='
display: none; ID=Test><LI style=' FONT-WEIGHT: bold;
FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-STYLE-TYPE:
disc'><a style='CURSOR: hand; COLOR: blue; TEXT-
DECORATION: none;' href='http://www.trinitypart ner.com'
alt='Trinity Partner Web Site'></a>My Other Link</LI><LI
style=' display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt;
FONT-FAMILY: Arial; LIST-STYLE-TYPE: disc'><a
style='CURSOR: hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner
Web Site'></a>My Other Link3</LI></TD> */

Regards, Pete.

-----Original Message-----
I just had the same problem. Check the generated HTML (View Source) and youwill see that the name of the user control is prepended to the ID. You willhave to find the control with the name UC:Element.

Lloyd Sheen

"trinitypete " <su*****@trinit y.com> wrote in message
news:04******* *************** ******@phx.gbl. ..
Hi all,

I have a user control that uses control literal to build a heading with a link, and a div containing links below.
As the link heading is hit, I want to change the style of the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse (Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error I have also tried document.all.wh ichElement

none of them seem to be able to locate the DIV.

/*
<HEAD>
<title>DefaultP age</title>
<meta content="Micros oft Visual
Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript"
name="vs_defaul tClientScript">
<meta
content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="IntranetS tyleSheet.css"
type="text/css" rel="stylesheet ">
</HEAD>
<body bottomMargin="0 " topMargin="10">
<form name="Form1" method="post"
action="Default .aspx" id="Form1">
<input type="hidden" name="__VIEWSTA TE"
value="dDwtODk2 MzgzMTIzO3Q8O2w 8aTwxPjs+O2w8dD w7bDxpPDE+Oz4 7bDx0PHA8cDxsPF BhZ2VJbmRleDtPd GhlckxpbmtzO090 aGVyTGlua3NVc mxzO0ltYWdlTGlu a0xlZnRJbWFnZVV ybDtJbWFnZUxpbm tMZWZ0VmlzaWJ sZTtVc2VyUGFnZX M7PjtsPGk8MD47Q DxDb250ZW50O01h aW50LlBhZ2U7R GVsZXRlIFBhZ2U7 PjtAPENvbnRlbnQ uYXNweD9QYWdlSW 5kZXg9MDtNYWl udFBhZ2UuYXNweD 9QYWdlSW5kZXg9M DtEZWxldGVQYWdl LmFzcHg/UGFnZ UluZGV4PTA7Pjsu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZztvPHQ+O0B UQ1MuQXBwbGljYX Rpb25zLk5ldC50Y 3NJbnRyYW5ldFBv cnRhbC5JbnRyY W5ldFBhZ2UsIHRj c0ludHJhbmV0Q2x hc3NlcywgVmVyc2 lvbj0xLjAuMC4 wLCBDdWx0dXJlPW 5ldXRyYWwsIFB1Y mxpY0tleVRva2Vu PW51bGw8YjxBQ UVBQUFELy8vLy9B UUFBQUFBQUFBQU1 BZ0FBQUVsMFkzTk piblJ5WVc1bGR FTnNZWE56WlhNc0 lGWmxjbk5wYjI0O U1TNHdMakF1TUN3 Z1EzVnNkSFZ5W lQxdVpYVjBjbUZz TENCUWRXSnNhV05 MWlhsVWIydGxiaj F1ZFd4c0JRRUF BQUF6VkVOVExrRn djR3hwWTJGMGFXO XVjeTVPWlhRdWRH TnpTVzUwY21Gd V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g==" />

<P>
<TABLE id="Table2" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD noWrap><a
id="PageHeaderC ontrol_ImageLin kLeft"><img
src="images/trinity_logo.jp g" border="0" /></a></TD>
<TD noWrap align="center"> </TD>
<TD noWrap align="right"></TD>
</TR>
<tr>
<td height="5"></td>
</tr>
</TABLE>
<TABLE id="Table1" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD id="PageHeaderC ontrol_tblcellP ages"
align="left" width="1%"><tab le cellspacing="0"
cellpadding="5" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="ActivePa ge" nowrap="nowrap"
align="Center"> <a class="PageLink " href="default.a spx?
PageIndex=0">Ho me</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="PageLink "
href="default.a spx?PageIndex=1 ">Page 1</a></td>
</tr>
</table></TD>

<TD class="Inactive Page"
width="98%"> </TD>
<TD id="PageHeaderC ontrol_tblcellM aint"
align="right">< table cellspacing="0" cellpadding="5"
align="Right" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="Inactive Page" nowrap="nowrap"
align="Center"> <a class="MaintLin k" href="Content.a spx?
PageIndex=0">Co ntent</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="MaintLin k"
href="MaintPage .aspx? PageIndex=0">Ma int.Page</a></td><td class="Inactive Page" nowrap="nowrap" align="Center"> <a
class="MaintLin k" href="DeletePag e.aspx?
PageIndex=0">De lete Page</a></td>
</tr>
</table></TD>

</TR>
<TR>
<TD class="PagerBac kground" colSpan="2"
height="4"></TD>
<TD class="PagerBac kground"
height="4"></TD>
</TR>
</TABLE>
</P>
<P>

<LINK href="../../IntranetStyleSh eet.css" type="text/css" rel="stylesheet ">
<TABLE class="Dialogue " id="Table1" cellSpacing="0"
cellPadding="10 " width="100%" border="0">
<TR>
<TD class="PagerBac kground" style="FONT-
WEIGHT: bold" align="center" height="20">Fav ourite
Links</TD>
<TD class="PagerBac kground" align="right"
width="2%" height="20"><in put type="submit"
name="Links1:bt nClose" value="X" id="Links1_btnC lose"
class="CloseBut ton" style="height:0 px;width:20px;" /></TD> </TR>
<TR>
<TD id=" " colspan="2"><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse()'>< IMG src='images/plus.jpg'
alt='Expand/Collapse Node' border='0'
height='10'></a> Personal</h5><DIV title = 'Yeh
right!' style=' display: none; ID='Personal'>< LI style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial;
LIST-STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR:
blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink1</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink2</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink3</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink4</LI></DIV><h5 STYLE='COLOR:bl ue'><a
STYLE='CURSOR: hand;' onclick='DoExpa ndCollapse()'>< IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a> Test</h5><DIV title
= 'Yeh right!' style=' display: none; ID='Test'><LI
style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link3</LI></TD>

</TR>
<TR>
<TD class="Pagerbac kground" align="right"
height="20"></TD>
<TD class="Pagerbac kground" noWrap
align="right" width="2%" height="20"><a
id="Links1_Hype rLink1">Maintai n Links</a></TD>
</TR>
</TABLE>
<script language="javas cript">
<!--
function DoExpandCollaps e()
{
alert(document. all.Personal);
/* alert(whichElem ent.id);
alert(whichElem ent.style.displ ay);
whichElement.st yle.display =
(whichElement.s tyle.display)?" ":"none";*/
}
//-->
</script>
<INPUT id="mybutton" type="button" value="Button">
</P>
</form>
</body>
*/
Any help would be appreciated.... .Pete

.

Nov 18 '05 #5
Please see reply to Lloyd.

Pete.
-----Original Message-----
Pete,

Another thing to note is that the ID on the server will often vary on theclient.

You may need to pass to your clientside javascript function the Client ID ofthe Div: Personal.Client ID

-- Alex Papadimoulis
"trinitypete " <su*****@trinit y.com> wrote in message
news:04******* *************** ******@phx.gbl. ..
Hi all,

I have a user control that uses control literal to build a heading with a link, and a div containing links below.
As the link heading is hit, I want to change the style of the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse (Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error I have also tried document.all.wh ichElement

none of them seem to be able to locate the DIV.

/*
<HEAD>
<title>DefaultP age</title>
<meta content="Micros oft Visual
Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript"
name="vs_defaul tClientScript">
<meta
content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="IntranetS tyleSheet.css"
type="text/css" rel="stylesheet ">
</HEAD>
<body bottomMargin="0 " topMargin="10">
<form name="Form1" method="post"
action="Default .aspx" id="Form1">
<input type="hidden" name="__VIEWSTA TE"
value="dDwtODk2 MzgzMTIzO3Q8O2w 8aTwxPjs+O2w8dD w7bDxpPDE+Oz4 7bDx0PHA8cDxsPF BhZ2VJbmRleDtPd GhlckxpbmtzO090 aGVyTGlua3NVc mxzO0ltYWdlTGlu a0xlZnRJbWFnZVV ybDtJbWFnZUxpbm tMZWZ0VmlzaWJ sZTtVc2VyUGFnZX M7PjtsPGk8MD47Q DxDb250ZW50O01h aW50LlBhZ2U7R GVsZXRlIFBhZ2U7 PjtAPENvbnRlbnQ uYXNweD9QYWdlSW 5kZXg9MDtNYWl udFBhZ2UuYXNweD 9QYWdlSW5kZXg9M DtEZWxldGVQYWdl LmFzcHg/UGFnZ UluZGV4PTA7Pjsu Li9pbWFnZXMvdHJ pbml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VBiR1ZtZEdoaGJt UnRiMlIxYkdWekV ISnBaMmgwYUdGdV pHMXZaSFZzWlh NQkFBWUdDQUlBQU FBR0F3QUFBQVpRW VdkbElESFFCd0FB Q1FRQUFBQUpCU UFBQUJFRUFBQUFB UUFBQUFZR0FBQUF BQkVGQUFBQUFRQU FBQWtHQUFBQUN 3PT0+Oz47Pj47Pj tsPGk8MT47aTwzP jtpPDU+Oz47bDx0 PHA8cDxsPEltY WdlVXJsOz47bDwu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZzs+Pjs+Ozs +O3Q8cDxwPGw8Vm lzaWJsZTs+O2w8b zxmPjs+Pjs+Ozs+ O3Q8cDxwPGw8V mlzaWJsZTs+O2w8 bzxmPjs+Pjs+Ozs +Oz4+Oz4+Oz4+Oz 4VjdJyQDGO4uo /blpMHMc/AvRcPg==" />

<P>
<TABLE id="Table2" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD noWrap><a
id="PageHeaderC ontrol_ImageLin kLeft"><img
src="images/trinity_logo.jp g" border="0" /></a></TD>
<TD noWrap align="center"> </TD>
<TD noWrap align="right"></TD>
</TR>
<tr>
<td height="5"></td>
</tr>
</TABLE>
<TABLE id="Table1" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD id="PageHeaderC ontrol_tblcellP ages"
align="left" width="1%"><tab le cellspacing="0"
cellpadding="5" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="ActivePa ge" nowrap="nowrap"
align="Center"> <a class="PageLink " href="default.a spx?
PageIndex=0">Ho me</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="PageLink "
href="default.a spx?PageIndex=1 ">Page 1</a></td>
</tr>
</table></TD>

<TD class="Inactive Page"
width="98%"> </TD>
<TD id="PageHeaderC ontrol_tblcellM aint"
align="right">< table cellspacing="0" cellpadding="5"
align="Right" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="Inactive Page" nowrap="nowrap"
align="Center"> <a class="MaintLin k" href="Content.a spx?
PageIndex=0">Co ntent</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="MaintLin k"
href="MaintPage .aspx? PageIndex=0">Ma int.Page</a></td><td class="Inactive Page" nowrap="nowrap" align="Center"> <a
class="MaintLin k" href="DeletePag e.aspx?
PageIndex=0">De lete Page</a></td>
</tr>
</table></TD>

</TR>
<TR>
<TD class="PagerBac kground" colSpan="2"
height="4"></TD>
<TD class="PagerBac kground"
height="4"></TD>
</TR>
</TABLE>
</P>
<P>

<LINK href="../../IntranetStyleSh eet.css" type="text/css" rel="stylesheet ">
<TABLE class="Dialogue " id="Table1" cellSpacing="0"
cellPadding="10 " width="100%" border="0">
<TR>
<TD class="PagerBac kground" style="FONT-
WEIGHT: bold" align="center" height="20">Fav ourite
Links</TD>
<TD class="PagerBac kground" align="right"
width="2%" height="20"><in put type="submit"
name="Links1:bt nClose" value="X" id="Links1_btnC lose"
class="CloseBut ton" style="height:0 px;width:20px;" /></TD> </TR>
<TR>
<TD id=" " colspan="2"><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse()'>< IMG src='images/plus.jpg'
alt='Expand/Collapse Node' border='0'
height='10'></a> Personal</h5><DIV title = 'Yeh
right!' style=' display: none; ID='Personal'>< LI style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial;
LIST-STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR:
blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink1</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink2</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink3</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink4</LI></DIV><h5 STYLE='COLOR:bl ue'><a
STYLE='CURSOR: hand;' onclick='DoExpa ndCollapse()'>< IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a> Test</h5><DIV title
= 'Yeh right!' style=' display: none; ID='Test'><LI
style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link3</LI></TD>

</TR>
<TR>
<TD class="Pagerbac kground" align="right"
height="20"></TD>
<TD class="Pagerbac kground" noWrap
align="right" width="2%" height="20"><a
id="Links1_Hype rLink1">Maintai n Links</a></TD>
</TR>
</TABLE>
<script language="javas cript">
<!--
function DoExpandCollaps e()
{
alert(document. all.Personal);
/* alert(whichElem ent.id);
alert(whichElem ent.style.displ ay);
whichElement.st yle.display =
(whichElement.s tyle.display)?" ":"none";*/
}
//-->
</script>
<INPUT id="mybutton" type="button" value="Button">
</P>
</form>
</body>
*/
Any help would be appreciated.... .Pete

.

Nov 18 '05 #6
OK a little bit more info:

I have worked out that the undefined error message goes
away if I place the name in quotes when callinf the
script.

e.g. before ExpandCollapse( Personal) now ExpandCollapse
("Personal") , however, I still cant access the DIV
elements, so I changed the expand collapse script to get
all DIV tags and display the ID's like so:

function DoExpandCollaps e()
{
alert('ExpandCo llapse');
var coll = document.all.ta gs("DIV");
for (i=0; i<coll.length; i++)
{
alert(coll[i].id);
}
}

The ID's are showing as empty string but I can see the
TWO DIVs in the source one with an ID of Test and another
with an ID of Personal. - Whats happening to the ID's?

Pete.
-----Original Message-----
I just had the same problem. Check the generated HTML (View Source) and youwill see that the name of the user control is prepended to the ID. You willhave to find the control with the name UC:Element.

Lloyd Sheen

"trinitypete " <su*****@trinit y.com> wrote in message
news:04******* *************** ******@phx.gbl. ..
Hi all,

I have a user control that uses control literal to build a heading with a link, and a div containing links below.
As the link heading is hit, I want to change the style of the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse (Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error I have also tried document.all.wh ichElement

none of them seem to be able to locate the DIV.

/*
<HEAD>
<title>DefaultP age</title>
<meta content="Micros oft Visual
Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript"
name="vs_defaul tClientScript">
<meta
content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="IntranetS tyleSheet.css"
type="text/css" rel="stylesheet ">
</HEAD>
<body bottomMargin="0 " topMargin="10">
<form name="Form1" method="post"
action="Default .aspx" id="Form1">
<input type="hidden" name="__VIEWSTA TE"
value="dDwtODk2 MzgzMTIzO3Q8O2w 8aTwxPjs+O2w8dD w7bDxpPDE+Oz4 7bDx0PHA8cDxsPF BhZ2VJbmRleDtPd GhlckxpbmtzO090 aGVyTGlua3NVc mxzO0ltYWdlTGlu a0xlZnRJbWFnZVV ybDtJbWFnZUxpbm tMZWZ0VmlzaWJ sZTtVc2VyUGFnZX M7PjtsPGk8MD47Q DxDb250ZW50O01h aW50LlBhZ2U7R GVsZXRlIFBhZ2U7 PjtAPENvbnRlbnQ uYXNweD9QYWdlSW 5kZXg9MDtNYWl udFBhZ2UuYXNweD 9QYWdlSW5kZXg9M DtEZWxldGVQYWdl LmFzcHg/UGFnZ UluZGV4PTA7Pjsu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZztvPHQ+O0B UQ1MuQXBwbGljYX Rpb25zLk5ldC50Y 3NJbnRyYW5ldFBv cnRhbC5JbnRyY W5ldFBhZ2UsIHRj c0ludHJhbmV0Q2x hc3NlcywgVmVyc2 lvbj0xLjAuMC4 wLCBDdWx0dXJlPW 5ldXRyYWwsIFB1Y mxpY0tleVRva2Vu PW51bGw8YjxBQ UVBQUFELy8vLy9B UUFBQUFBQUFBQU1 BZ0FBQUVsMFkzTk piblJ5WVc1bGR FTnNZWE56WlhNc0 lGWmxjbk5wYjI0O U1TNHdMakF1TUN3 Z1EzVnNkSFZ5W lQxdVpYVjBjbUZz TENCUWRXSnNhV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DxwPGw8V mlzaWJsZTs+O2w8 bzxmPjs+Pjs+Ozs +Oz4+Oz4+Oz4+Oz 4VjdJyQDGO4uo /blpMHMc/AvRcPg==" />

<P>
<TABLE id="Table2" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD noWrap><a
id="PageHeaderC ontrol_ImageLin kLeft"><img
src="images/trinity_logo.jp g" border="0" /></a></TD>
<TD noWrap align="center"> </TD>
<TD noWrap align="right"></TD>
</TR>
<tr>
<td height="5"></td>
</tr>
</TABLE>
<TABLE id="Table1" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD id="PageHeaderC ontrol_tblcellP ages"
align="left" width="1%"><tab le cellspacing="0"
cellpadding="5" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="ActivePa ge" nowrap="nowrap"
align="Center"> <a class="PageLink " href="default.a spx?
PageIndex=0">Ho me</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="PageLink "
href="default.a spx?PageIndex=1 ">Page 1</a></td>
</tr>
</table></TD>

<TD class="Inactive Page"
width="98%"> </TD>
<TD id="PageHeaderC ontrol_tblcellM aint"
align="right">< table cellspacing="0" cellpadding="5"
align="Right" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="Inactive Page" nowrap="nowrap"
align="Center"> <a class="MaintLin k" href="Content.a spx?
PageIndex=0">Co ntent</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="MaintLin k"
href="MaintPage .aspx? PageIndex=0">Ma int.Page</a></td><td class="Inactive Page" nowrap="nowrap" align="Center"> <a
class="MaintLin k" href="DeletePag e.aspx?
PageIndex=0">De lete Page</a></td>
</tr>
</table></TD>

</TR>
<TR>
<TD class="PagerBac kground" colSpan="2"
height="4"></TD>
<TD class="PagerBac kground"
height="4"></TD>
</TR>
</TABLE>
</P>
<P>

<LINK href="../../IntranetStyleSh eet.css" type="text/css" rel="stylesheet ">
<TABLE class="Dialogue " id="Table1" cellSpacing="0"
cellPadding="10 " width="100%" border="0">
<TR>
<TD class="PagerBac kground" style="FONT-
WEIGHT: bold" align="center" height="20">Fav ourite
Links</TD>
<TD class="PagerBac kground" align="right"
width="2%" height="20"><in put type="submit"
name="Links1:bt nClose" value="X" id="Links1_btnC lose"
class="CloseBut ton" style="height:0 px;width:20px;" /></TD> </TR>
<TR>
<TD id=" " colspan="2"><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse()'>< IMG src='images/plus.jpg'
alt='Expand/Collapse Node' border='0'
height='10'></a> Personal</h5><DIV title = 'Yeh
right!' style=' display: none; ID='Personal'>< LI style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial;
LIST-STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR:
blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink1</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink2</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink3</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink4</LI></DIV><h5 STYLE='COLOR:bl ue'><a
STYLE='CURSOR: hand;' onclick='DoExpa ndCollapse()'>< IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a> Test</h5><DIV title
= 'Yeh right!' style=' display: none; ID='Test'><LI
style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link3</LI></TD>

</TR>
<TR>
<TD class="Pagerbac kground" align="right"
height="20"></TD>
<TD class="Pagerbac kground" noWrap
align="right" width="2%" height="20"><a
id="Links1_Hype rLink1">Maintai n Links</a></TD>
</TR>
</TABLE>
<script language="javas cript">
<!--
function DoExpandCollaps e()
{
alert(document. all.Personal);
/* alert(whichElem ent.id);
alert(whichElem ent.style.displ ay);
whichElement.st yle.display =
(whichElement.s tyle.display)?" ":"none";*/
}
//-->
</script>
<INPUT id="mybutton" type="button" value="Button">
</P>
</form>
</body>
*/
Any help would be appreciated.... .Pete

.

Nov 18 '05 #7
GOT IT.....

I didn't think it mattered (maybe someone can confirm)
but the HTML I was rendering via the literal control for
the DIV was as follows:

/*<DIV style=' display: none; id="Personal"> */

Event changing the function to loop through elements I
could see the DIV but it had no ID. I changed the HTML

/*<DIV id="Personal"; style=' display: none;>*/

and it worked a treat?????????

I thought the order of HTML tags was irrelevant?

Pete.
-----Original Message-----
I just had the same problem. Check the generated HTML (View Source) and youwill see that the name of the user control is prepended to the ID. You willhave to find the control with the name UC:Element.

Lloyd Sheen

"trinitypete " <su*****@trinit y.com> wrote in message
news:04******* *************** ******@phx.gbl. ..
Hi all,

I have a user control that uses control literal to build a heading with a link, and a div containing links below.
As the link heading is hit, I want to change the style of the div, making it visible or not. Yep you guessed it,
expanding tree type functionality.

The header has an onclick event onclick='Doexpa ndcollapse (Personal)'

The div is set as follows "<DIV> ID=Personal".

From the page load event in the user control I register a client script block.

function Doexpandcollaps e(whichElement)
{
whichElement.st yle.display=
(whichelement.s tyle.display="n one")?" ":"none";
}

I get an error Personal is undefined.
I have also tried document.all.Pe rsonal get the same error I have also tried document.all.wh ichElement

none of them seem to be able to locate the DIV.

/*
<HEAD>
<title>DefaultP age</title>
<meta content="Micros oft Visual
Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript"
name="vs_defaul tClientScript">
<meta
content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<LINK href="IntranetS tyleSheet.css"
type="text/css" rel="stylesheet ">
</HEAD>
<body bottomMargin="0 " topMargin="10">
<form name="Form1" method="post"
action="Default .aspx" id="Form1">
<input type="hidden" name="__VIEWSTA TE"
value="dDwtODk2 MzgzMTIzO3Q8O2w 8aTwxPjs+O2w8dD w7bDxpPDE+Oz4 7bDx0PHA8cDxsPF BhZ2VJbmRleDtPd GhlckxpbmtzO090 aGVyTGlua3NVc mxzO0ltYWdlTGlu a0xlZnRJbWFnZVV ybDt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0OU1TNHdMakF1 TUN3Z1EzVnNkSFZ 5WlQxdVpYVjBjbU ZzTENCUWRXSnN hV05MWlhsVWIydG xiajF1ZFd4c0JRR UFBQUF6VkVOVExr RndjR3hwWTJGM GFXOXVjeTVPWlhR dWRHTnpTVzUwY21 GdVpYUlFiM0owWV d3dVNXNTBjbUZ 1WlhSUVlXZGxCQU FBQUFad1lXZGxhV 1FPYzJWeGRXVnVZ MlZ1ZFcxaVpYS VBiR1ZtZEdoaGJt UnRiMlIxYkdWekV ISnBaMmgwYUdGdV pHMXZaSFZzWlh NQkFBWUdDQUlBQU FBR0F3QUFBQVpRW VdkbElESFFCd0FB Q1FRQUFBQUpCU UFBQUJFRUFBQUFB UUFBQUFZR0FBQUF BQkVGQUFBQUFRQU FBQWtHQUFBQUN 3PT0+Oz47Pj47Pj tsPGk8MT47aTwzP jtpPDU+Oz47bDx0 PHA8cDxsPEltY WdlVXJsOz47bDwu Li9pbWFnZXMvdHJ pbml0eV9sb2dvLm pwZzs+Pjs+Ozs +O3Q8cDxwPGw8Vm lzaWJsZTs+O2w8b zxmPjs+Pjs+Ozs+ O3Q8cDxwPGw8V mlzaWJsZTs+O2w8 bzxmPjs+Pjs+Ozs +Oz4+Oz4+Oz4+Oz 4VjdJyQDGO4uo /blpMHMc/AvRcPg==" />

<P>
<TABLE id="Table2" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD noWrap><a
id="PageHeaderC ontrol_ImageLin kLeft"><img
src="images/trinity_logo.jp g" border="0" /></a></TD>
<TD noWrap align="center"> </TD>
<TD noWrap align="right"></TD>
</TR>
<tr>
<td height="5"></td>
</tr>
</TABLE>
<TABLE id="Table1" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<TR>
<TD id="PageHeaderC ontrol_tblcellP ages"
align="left" width="1%"><tab le cellspacing="0"
cellpadding="5" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="ActivePa ge" nowrap="nowrap"
align="Center"> <a class="PageLink " href="default.a spx?
PageIndex=0">Ho me</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="PageLink "
href="default.a spx?PageIndex=1 ">Page 1</a></td>
</tr>
</table></TD>

<TD class="Inactive Page"
width="98%"> </TD>
<TD id="PageHeaderC ontrol_tblcellM aint"
align="right">< table cellspacing="0" cellpadding="5"
align="Right" border="0" style="width:10 0%;border-
collapse:collap se;">
<tr>
<td class="Inactive Page" nowrap="nowrap"
align="Center"> <a class="MaintLin k" href="Content.a spx?
PageIndex=0">Co ntent</a></td><td class="Inactive Page"
nowrap="nowrap" align="Center"> <a class="MaintLin k"
href="MaintPage .aspx? PageIndex=0">Ma int.Page</a></td><td class="Inactive Page" nowrap="nowrap" align="Center"> <a
class="MaintLin k" href="DeletePag e.aspx?
PageIndex=0">De lete Page</a></td>
</tr>
</table></TD>

</TR>
<TR>
<TD class="PagerBac kground" colSpan="2"
height="4"></TD>
<TD class="PagerBac kground"
height="4"></TD>
</TR>
</TABLE>
</P>
<P>

<LINK href="../../IntranetStyleSh eet.css" type="text/css" rel="stylesheet ">
<TABLE class="Dialogue " id="Table1" cellSpacing="0"
cellPadding="10 " width="100%" border="0">
<TR>
<TD class="PagerBac kground" style="FONT-
WEIGHT: bold" align="center" height="20">Fav ourite
Links</TD>
<TD class="PagerBac kground" align="right"
width="2%" height="20"><in put type="submit"
name="Links1:bt nClose" value="X" id="Links1_btnC lose"
class="CloseBut ton" style="height:0 px;width:20px;" /></TD> </TR>
<TR>
<TD id=" " colspan="2"><h5
STYLE='COLOR:bl ue'><a STYLE='CURSOR: hand;'
onclick='DoExpa ndCollapse()'>< IMG src='images/plus.jpg'
alt='Expand/Collapse Node' border='0'
height='10'></a> Personal</h5><DIV title = 'Yeh
right!' style=' display: none; ID='Personal'>< LI style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial;
LIST-STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR:
blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink1</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink2</LI><LI style=' display: none; FONT-
WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LIST-
STYLE-TYPE: disc'><a style='CURSOR: hand; COLOR: blue;
TEXT-DECORATION: none;' href='http://www.microsoft.c om'
alt='Microsofts Web Site'></a>MyLink3</LI><LI style='
display: none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-
FAMILY: Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR:
hand; COLOR: blue; TEXT-DECORATION: none;'
href='http://www.microsoft.c om' alt='Microsofts Web
Site'></a>MyLink4</LI></DIV><h5 STYLE='COLOR:bl ue'><a
STYLE='CURSOR: hand;' onclick='DoExpa ndCollapse()'>< IMG
src='images/plus.jpg' alt='Expand/Collapse Node'
border='0' height='10'></a> Test</h5><DIV title
= 'Yeh right!' style=' display: none; ID='Test'><LI
style=' FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link1</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link2</LI><LI style=' display:
none; FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY:
Arial; LIST-STYLE-TYPE: disc'><a style='CURSOR: hand;
COLOR: blue; TEXT-DECORATION: none;'
href='http://www.trinitypart ner.com' alt='Trinity Partner Web Site'></a>My Other Link3</LI></TD>

</TR>
<TR>
<TD class="Pagerbac kground" align="right"
height="20"></TD>
<TD class="Pagerbac kground" noWrap
align="right" width="2%" height="20"><a
id="Links1_Hype rLink1">Maintai n Links</a></TD>
</TR>
</TABLE>
<script language="javas cript">
<!--
function DoExpandCollaps e()
{
alert(document. all.Personal);
/* alert(whichElem ent.id);
alert(whichElem ent.style.displ ay);
whichElement.st yle.display =
(whichElement.s tyle.display)?" ":"none";*/
}
//-->
</script>
<INPUT id="mybutton" type="button" value="Button">
</P>
</form>
</body>
*/
Any help would be appreciated.... .Pete

.

Nov 18 '05 #8
Hi Peter,

I am glad to know that the problem is resolved.

For the issue regarding the order of HTML tags, I cannot reproduce the
problem on my side. Please try the following simple code snippet on your
side.

--------------------------------------
<html>
<head>
<title>My Example</title>
<script language="Javas cript">
var origDivHTML;

function init()
{
origDivHTML = myDiv.innerHTML ;
}

function setValues()
{
var oldinnerHTML = "your original innerHTML: " + yourDiv.innerHT ML ;
alert(oldinnerH TML);
yourDiv.innerHT ML = origDivHTML;

var curinnerHTML = "your current innerHTML: " + yourDiv.innerHT ML ;
alert(curinnerH TML);
}
</script>
</head>

<body onload="init()" >

<div style="" id="myDiv">
<select name="firstSele ct" size="1" >
<option>11111 </option>
<option>22222 </option>
<option>33333 </option>
</select>
</div>

<div style="" id="yourDiv">
<select name="secondSel ect" size="1" >
<option>aaaa</option>
<option>bbbb</option>
<option>cccc</option>
</select>
</div>
<button onclick = "setValues();"> click me to set the values</button>
</body>
</html>
--------------------------------------

Would you pleaes try to reproduce the problem on your side with the above
testing sample? I certainly appreciate your time.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #9
Jacob,

Thanks for your reply and code snippet. I implemented the
code and it seemed fine, unsure what was happening in my
example other that the HTML was rendered from a user
control. I could zip up a quick example and send it to
you if you like? Please let me know.

Regards, Pete.
-----Original Message-----
Hi Peter,

I am glad to know that the problem is resolved.

For the issue regarding the order of HTML tags, I cannot reproduce the problem on my side. Please try the following simple code snippet on your side.

--------------------------------------
<html>
<head>
<title>My Example</title>
<script language="Javas cript">
var origDivHTML;

function init()
{
origDivHTML = myDiv.innerHTML ;
}

function setValues()
{
var oldinnerHTML = "your original innerHTML: " + yourDiv.innerHT ML ; alert(oldinnerH TML);
yourDiv.innerHT ML = origDivHTML;

var curinnerHTML = "your current innerHTML: " + yourDiv.innerHT ML ; alert(curinnerH TML);
}
</script>
</head>

<body onload="init()" >

<div style="" id="myDiv">
<select name="firstSele ct" size="1" >
<option>11111 </option>
<option>22222 </option>
<option>33333 </option>
</select>
</div>

<div style="" id="yourDiv">
<select name="secondSel ect" size="1" >
<option>aaaa</option>
<option>bbbb</option>
<option>cccc</option>
</select>
</div>
<button onclick = "setValues();"> click me to set the values</button></body>
</html>
--------------------------------------

Would you pleaes try to reproduce the problem on your side with the above testing sample? I certainly appreciate your time.

If I have misunderstood your concern, please feel free to let me know.
Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.

Nov 18 '05 #10

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

Similar topics

4
4287
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage I know I need to call a function that will save data but I'm not sure exactly when to call this function. I've tried two ways and both seem to have 'gotcha's':
1
1497
by: george d lake | last post by:
Hi, I have a user control that has a series of web controls in it. I need to access the web controls from the parent page via javascript. No, I have done this in the past but know I am having problems. It just will not find the obj on the javascript side. here is some code (HTML output): <span id="ucUntouchedItems_spUntouched" style="CURSOR:hand;COLOR:#003399"
1
1230
by: RSB | last post by:
Hi all, Sorry for asking to many questions.. one more problem. i have a Form and in that form i am adding a user control "myUserControl" which has two text boxes. textbox1 and textbox2. Now if i am executing a Javascript function right inside the user control ..
4
2458
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item, what do I need to do in order to return the "option value" of the control? Moe !--- returned value of the control
2
2155
by: bill | last post by:
I have the following user control in my project simply for setting focus to a control: Public Class SetFocus Inherits System.Web.UI.UserControl
1
2159
by: Barbara Alderton | last post by:
I have the following scenario: I have a user control that contains a registered menu control. The menu and other information on the user control is specific to the user accessing the site. This user control is used on many pages. In order to create this control, I need to access information in the Active Directory to create both the menu and other info displayed on the control. This access takes some time and I wanted to cache this...
4
297
by: barry | last post by:
I have a <asp:panel defined on a asp.net 1.1 version. I have some javascript that is executed on an action in the panel. This works fine. but When I put the panel to an ascx file and then try to access the panel in the same javascript it does not recognized the panel.
1
2158
by: Shraddha | last post by:
Hi, I am adding some ASP.Net user controls (.ascx file) dynamically on the button click. The user control will get added as many times userhits the button. Now on the click of the submit button, I want to do some form level validations. For example suppose my .ascx file contains a text box with id say "trialTextBox". Now if user hits the button thrice, 3 user controls will be there on the page and as a result 3 textboxes mentioned...
4
4237
by: archana | last post by:
Hi all, i am having one user control. what i want is to add javascript which will gets called on button click of user control. but user control is not working if i add javascript in user control.. but if i add javascript in page in which i am adding user control then that javascript is executed properly. i tested by displaying alert message in javascript. can anyone tell
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9179
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8099
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.