s.vd.kooij
Joined: 12 Jan 2005 Posts: 4
|
Posted: Tue Jul 25, 2006 8:49 am Post subject: Can't get ASP.NET & Postback to work with form elements |
|
|
Hi.
I got cooljsmenu 2.4.8 recently but i still can't get it to work on asp.net pages..
Everytime I receive a "object reference not set to an instance of an object" error (Null ReferenceExeption) on the line that looks much like this (c# codebehind):
| Code: |
string strSeachText = Request.Form["Search"].ToString();
|
The part of the menu definition looks like:
| Code: |
{code:'Find your text: <input type="text" name="Seach" />', hasControls:true}
|
The menu init inside the <form runat=server> tag:
| Code: |
<script type="text/javascript">
<!--
var m1 = new COOLjsMenuPRO("menu1", MENU_ITEMS);
m1.initTop();
m1.init();
m1.show();
// -->
</script>
|
The menu itself works fine
Any ideas ? |
|
AlexKunin Developer
Joined: 03 Jan 2003 Posts: 1191
|
Posted: Thu Aug 17, 2006 8:40 am Post subject: |
|
|
The control just does not exist when you're trying to access it. Menu creates its items dynamically, i.e. item and its HTML code (and related branch of DOM hierarchy) does not exist until item becomes visible.
Try to use dynamic:false argument. But this will slow things down if your menu is large.
| Code: | var MENU_ITEMS = [
{pos:..., size:[...], dynamic:false, ...},
...
]; |
|
|