By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,550 Members | 1,733 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,550 IT Pros & Developers. It's quick & easy.

Y "object expected" ?

P: n/a
Hi,
I have problem to get the control id and set its visible to true/false(mean
show/hide).

here is my code:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="ucNavbar.ascx.vb" Inherits="UserInterfaceDesign.ucNavbar"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<A id="hpL" href="" DESIGNTIMEDRAGDROP="59" runat="server"
onmouseover="window.status='<I>text to display in status bar</I>'; return
true;">
Make Request</A>

<asp:linkbutton id="lbtnSupport" runat="server"
Width="104px">Support</asp:linkbutton>
<asp:linkbutton id="lbtnLogoff" runat="server">Log off</asp:linkbutton>
<DIV id="divNavmakereq" style="VISIBILITY: visible; WIDTH: 144px; POSITION:
relative; HEIGHT: 100px; BACKGROUND-COLOR: aqua"
runat="server" ms_positioning="GridLayout"><INPUT style="Z-INDEX: 101;
LEFT: 8px; POSITION: absolute; TOP: 8px" type="button" value="Yahoo"></DIV>
<script type="text/javascript">
function fn_mouseoverjavascript(){
alert(document.getElementById('divNavmakereq');
}

</script>

in the javascript function, i try to show the control name, the error
message prompt:
object expected. Actually my concern is to show / hide the divNavmakereq
control.

have any ideas?
I already out of ideas.
thank you in advance.

best regards,
GL
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Have you checked the name of the DIV tag.

When you use controls, generally your TAGS are renamed UC1_IDNAME (or
something like that)

Double check the ID name like this:
When you are viewing the Webpage in IE, click View --> Source
Look at the DIV tag you are trying to use, and check its name has not
changed from divNavmakereq to something else
If it has, thats your problem, just update you JavaScript with the right
ID name

alert(document.getElementById('TheNameYouFindInThe Source'); //not sure
what you trying to do with that line, might need to add ID in there to get a
value

But what you really want is
document.getElementById('TheNameYouFindInTheSource ').style.visibility =
"hidden";

"Daniel" <Da****@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Hi,
I have problem to get the control id and set its visible to
true/false(mean
show/hide).

here is my code:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="ucNavbar.ascx.vb" Inherits="UserInterfaceDesign.ucNavbar"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<A id="hpL" href="" DESIGNTIMEDRAGDROP="59" runat="server"
onmouseover="window.status='<I>text to display in status bar</I>'; return
true;">
Make Request</A>

<asp:linkbutton id="lbtnSupport" runat="server"
Width="104px">Support</asp:linkbutton>
<asp:linkbutton id="lbtnLogoff" runat="server">Log off</asp:linkbutton>
<DIV id="divNavmakereq" style="VISIBILITY: visible; WIDTH: 144px;
POSITION:
relative; HEIGHT: 100px; BACKGROUND-COLOR: aqua"
runat="server" ms_positioning="GridLayout"><INPUT style="Z-INDEX: 101;
LEFT: 8px; POSITION: absolute; TOP: 8px" type="button"
value="Yahoo"></DIV>
<script type="text/javascript">
function fn_mouseoverjavascript(){
alert(document.getElementById('divNavmakereq');
}

</script>

in the javascript function, i try to show the control name, the error
message prompt:
object expected. Actually my concern is to show / hide the divNavmakereq
control.

have any ideas?
I already out of ideas.
thank you in advance.

best regards,
GL

Nov 19 '05 #2

P: n/a
HI Grant Merwitz,
thanks for ur respond.
i have a question, actually the source code is from user control page.
i try to show/hide the divNavmakereq.
So, the technique is still same as u replied to me ?

"Grant Merwitz" wrote:
Have you checked the name of the DIV tag.

When you use controls, generally your TAGS are renamed UC1_IDNAME (or
something like that)

Double check the ID name like this:
When you are viewing the Webpage in IE, click View --> Source
Look at the DIV tag you are trying to use, and check its name has not
changed from divNavmakereq to something else
If it has, thats your problem, just update you JavaScript with the right
ID name

alert(document.getElementById('TheNameYouFindInThe Source'); //not sure
what you trying to do with that line, might need to add ID in there to get a
value

But what you really want is
document.getElementById('TheNameYouFindInTheSource ').style.visibility =
"hidden";

"Daniel" <Da****@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Hi,
I have problem to get the control id and set its visible to
true/false(mean
show/hide).

here is my code:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="ucNavbar.ascx.vb" Inherits="UserInterfaceDesign.ucNavbar"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<A id="hpL" href="" DESIGNTIMEDRAGDROP="59" runat="server"
onmouseover="window.status='<I>text to display in status bar</I>'; return
true;">
Make Request</A>

<asp:linkbutton id="lbtnSupport" runat="server"
Width="104px">Support</asp:linkbutton>
<asp:linkbutton id="lbtnLogoff" runat="server">Log off</asp:linkbutton>
<DIV id="divNavmakereq" style="VISIBILITY: visible; WIDTH: 144px;
POSITION:
relative; HEIGHT: 100px; BACKGROUND-COLOR: aqua"
runat="server" ms_positioning="GridLayout"><INPUT style="Z-INDEX: 101;
LEFT: 8px; POSITION: absolute; TOP: 8px" type="button"
value="Yahoo"></DIV>
<script type="text/javascript">
function fn_mouseoverjavascript(){
alert(document.getElementById('divNavmakereq');
}

</script>

in the javascript function, i try to show the control name, the error
message prompt:
object expected. Actually my concern is to show / hide the divNavmakereq
control.

have any ideas?
I already out of ideas.
thank you in advance.

best regards,
GL


Nov 19 '05 #3

P: n/a
Thank you. I already get..hehe

"Daniel" wrote:
Hi,
I have problem to get the control id and set its visible to true/false(mean
show/hide).

here is my code:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="ucNavbar.ascx.vb" Inherits="UserInterfaceDesign.ucNavbar"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<A id="hpL" href="" DESIGNTIMEDRAGDROP="59" runat="server"
onmouseover="window.status='<I>text to display in status bar</I>'; return
true;">
Make Request</A>

<asp:linkbutton id="lbtnSupport" runat="server"
Width="104px">Support</asp:linkbutton>
<asp:linkbutton id="lbtnLogoff" runat="server">Log off</asp:linkbutton>
<DIV id="divNavmakereq" style="VISIBILITY: visible; WIDTH: 144px; POSITION:
relative; HEIGHT: 100px; BACKGROUND-COLOR: aqua"
runat="server" ms_positioning="GridLayout"><INPUT style="Z-INDEX: 101;
LEFT: 8px; POSITION: absolute; TOP: 8px" type="button" value="Yahoo"></DIV>
<script type="text/javascript">
function fn_mouseoverjavascript(){
alert(document.getElementById('divNavmakereq');
}

</script>

in the javascript function, i try to show the control name, the error
message prompt:
object expected. Actually my concern is to show / hide the divNavmakereq
control.

have any ideas?
I already out of ideas.
thank you in advance.

best regards,
GL

Nov 19 '05 #4

P: n/a
oh, HAHA

I was writing the reply but got distracted.

Well, waste not want not.

Here's what i was saying:
as this div tag has a Runat=server, when this control is implemented into
you page, it will rename it with the TagName you specified.

so, if you register you tag like so:

<%@ Regoster TagPrefix="uc1" TagName="MyControl" ...

and you called your Div Tag 'divNavmakereq'

This will be renamed at run time to :
MyControl_divNavmakereq - or something like that

So, when you testing your control, on the page its being used (aspx), view
the source of that page and get its ID.
Bearing in mind, this control will have to have the same TagName wherever it
is used - or this code will not work in that instance.

There's also probably a better way of doing this that its not dependent on
the ID so much, like passing the control to your JavaScript.
But this will work

"Daniel" <Da****@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
Thank you. I already get..hehe

"Daniel" wrote:
Hi,
I have problem to get the control id and set its visible to
true/false(mean
show/hide).

here is my code:
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="ucNavbar.ascx.vb" Inherits="UserInterfaceDesign.ucNavbar"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<A id="hpL" href="" DESIGNTIMEDRAGDROP="59" runat="server"
onmouseover="window.status='<I>text to display in status bar</I>'; return
true;">
Make Request</A>

<asp:linkbutton id="lbtnSupport" runat="server"
Width="104px">Support</asp:linkbutton>
<asp:linkbutton id="lbtnLogoff" runat="server">Log off</asp:linkbutton>
<DIV id="divNavmakereq" style="VISIBILITY: visible; WIDTH: 144px;
POSITION:
relative; HEIGHT: 100px; BACKGROUND-COLOR: aqua"
runat="server" ms_positioning="GridLayout"><INPUT style="Z-INDEX: 101;
LEFT: 8px; POSITION: absolute; TOP: 8px" type="button"
value="Yahoo"></DIV>
<script type="text/javascript">
function fn_mouseoverjavascript(){
alert(document.getElementById('divNavmakereq');
}

</script>

in the javascript function, i try to show the control name, the error
message prompt:
object expected. Actually my concern is to show / hide the divNavmakereq
control.

have any ideas?
I already out of ideas.
thank you in advance.

best regards,
GL

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.