Anytime I do a document.submit() call I get

Oct 27, 2010 at 5:53 AM

Anytime I do a document.submit() call from javascript on a regular asp.net button I get:

 

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Nii.JSON.JSONTokener.more() +6
   Nii.JSON.JSONTokener.next() +13
   Nii.JSON.JSONObject..ctor(JSONTokener x) +26
   ExtAspNet.ResourceManager.get_PostBackStates() +121
   ExtAspNet.ControlBase.get_PostBackState() +46
   ExtAspNet.ControlBase.OnInit(EventArgs e) +92
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378
Oct 27, 2010 at 6:01 AM

Adding a

__doPostBack('CALL', 'CALL');

before document.submit()

seems to get around the problem

Oct 27, 2010 at 6:51 AM

Actually the __doPostBack doesnt work.

Help please?! :)

May 11, 2011 at 7:00 PM

Hi sanshi,

Do you know anyway around this?

May 12, 2011 at 2:55 AM
Edited May 12, 2011 at 3:05 AM

like this,can submit

test.aspx.cs

        protected void Button1_Click(object sender, EventArgs e)
        {
            ExtAspNet.PageContext.RegisterStartupScript("__doPostBack('calltest1','calltest2');");
        }

 

...

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }
            else
            {
                if ((Request.Form["__EVENTTARGET"] == "calltest1") & (Request.Form["__EVENTARGUMENT"] == "calltest2"))
                {
                    ExtAspNet.Alert.Show("this is calltest");
                }

            }
        }

May 12, 2011 at 3:38 AM

Hi, thats not working either. The button has to call a javascript function, which does a document.submit() call. It still errors out because that is called before the __doPostBack('calltest1','calltest2') is done. The ExtAspNet.ResourceManager.get_PostBackStates() is not getting filled when doing a document.submit() which is error things out.

May 12, 2011 at 3:44 AM

ExtAspNet.ResourceManager??

your extaspnet version is??

v2.2?

 

 

May 14, 2011 at 4:06 PM

Hi, it works fine in version 2.2, but if I use a version higher it gives me the error. I havent tried the latest build.