menu controls on 2.0 ..

J

jason

As I surf the net I see so many cool drop down menus.. I'm wondering
are most of those non .net or third party? Perhaps I just don't know
what I'm doing in vs.net, but the delivered menus do seem kinda lame.

I've read there is no way to remove that little arrow when there are
sub menu items? True?

Also, how do build a horizontal menu where individual items have a
border around them and transparent or blank spaces between them? do I
have to insert my own image to do this? I hope not.
 
J

jason

Steve, nice site.

Off topic, regarding the NumericTextbox example on the site, I'm kinda
noob, how do I implement that?

I tried adding in a new class and importing the new namespace into the
codebehind and then doing this on the aspx page.

<asp:textbox runat="server" OnKeyPress="ValidateNumeric()"/>

but 2.0 does not like OnKeyPress

I also tried,
<asp:NumericTextbox runat="server" OnKeyPress="ValidateNumeric()"/>

but that did not work either.

Perhaps I needed to add it as a new web component or something.. it was
not clear to me, maybe I missed something in the docs.

Thanks.
 
M

Mark Rae

Off topic, regarding the NumericTextbox example on the site, I'm kinda
noob, how do I implement that?

I tried adding in a new class and importing the new namespace into the
codebehind and then doing this on the aspx page.

<asp:textbox runat="server" OnKeyPress="ValidateNumeric()"/>

but 2.0 does not like OnKeyPress

Hmm - maybe I'm missing something too, but I can't see how this can ever
work, because this will be looking for the OnKeyPress event server-side.
However, the following should work (I haven't tested it...):

<asp:TextBox ID="txtNumericTextBox" runat="server" />

Then, in your Page_Load event:

txtNumericTextBox.Attribtes.Add("onKeyPress", "ValidateNumeric()";);
 
J

jason

I'm trying this. my Page_load is in the codebehind file of course which
is in the page directive. It's a masterpage not sure that matters.

know why I might be getting a "does not exsist in the current context"
error for txtNumericTextBox? I checked and thats the same textbox id on
the page.

I also tried calling the javascript function from ontextchanged=, but
that did not work either.
 
M

Mark Rae

I'm trying this. my Page_load is in the codebehind file of course which
is in the page directive. It's a masterpage not sure that matters.
Ah...

know why I might be getting a "does not exsist in the current context"
error for txtNumericTextBox? I checked and thats the same textbox id on
the page.

Is the <asp:TextBox also in the MasterPage?

Where is the ValidateNumeric() JavaScript function...?
I also tried calling the javascript function from ontextchanged=, but
that did not work either.

No - it won't for the same reason that onKeyPress isn't working...
 
J

jason

the javascript function is on the master page, but I'm testing the
masterpage.. if that worked, I would have tried one of the content
pages.
 
M

Mark Rae

the javascript function is on the master page, but I'm testing the
masterpage.. if that worked, I would have tried one of the content
pages.

How can you "test" a MasterPage without a ContentPage...?
 
J

jason

True. It has to be in the contentpages' page_load.

It compiled cleanly, but there does appear to be some more work when
working with javasript and master pages - many posts on this. In some
cases javascript must be generated dynamically and clientid must be
used.

In this simple example, I have the javascript block in masterpage and
the
TextBox1.Attributes.Add("onKeyPress", "ValidateNumeric()");
line in the page_load of the contentpage.

The minute I strike a key in the text box, I get a javascript error
"Object Expected"

I check the page source and I do see the javascript function.

<script language="javascript" type="text/javascript ">
function ValidateNumeric()
{
var keyCode = window.event.keyCode;
if (keyCode > 57 || keyCode < 48)
window.event.returnValue = false;
}
</script>


Any ideas?
 
M

Mark Rae

In this simple example, I have the javascript block in masterpage and
the
TextBox1.Attributes.Add("onKeyPress", "ValidateNumeric()");
line in the page_load of the contentpage.

The minute I strike a key in the text box, I get a javascript error
"Object Expected"

I check the page source and I do see the javascript function.

<script language="javascript" type="text/javascript ">
function ValidateNumeric()
{
var keyCode = window.event.keyCode;
if (keyCode > 57 || keyCode < 48)
window.event.returnValue = false;
}
</script>

Any ideas?

You need to set a breakpoint (or insert the word debugger;) at the top of
your ValidateNumeric function and step through it...
 
T

tylerbockler

I had a similar problem on this subject. I replaced my javascript
block with an include js file and it worked great. I'm trying to find
an answer as to why, but it did the trick with me!
 
M

Mark Rae

I had a similar problem on this subject. I replaced my javascript
block with an include js file and it worked great. I'm trying to find
an answer as to why, but it did the trick with me!

Hmm - that's interesting. I have several standard JavaScript routines
(validation, formatting etc) which I usually put in my MasterPages, but they
are in include files...

I'd be really interested to know why this makes a difference...
 
J

jason

Its working now. If figured out what it was

<script language="javascript" type="text/javascript ">

The space before the last doublequote believe it or not.
 
M

Mark Rae

Its working now. If figured out what it was

<script language="javascript" type="text/javascript ">

The space before the last doublequote believe it or not.

Wow! That's weird...!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top