JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't get ASP.NET & Postback to work with form elements

 
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu
Author Message
s.vd.kooij



Joined: 12 Jan 2005
Posts: 4

PostPosted: Tue Jul 25, 2006 8:49 am    Post subject: Can't get ASP.NET & Postback to work with form elements Reply with quote

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 ?
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Thu Aug 17, 2006 8:40 am    Post subject: Reply with quote

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, ...},
    ...
];
Back to top
Display posts from previous:   
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu All times are GMT
Page 1 of 1