Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem with calling dopostbackProblem with calling dopostback
Previous
 
Next
New Post
2/26/2009 5:40 PM
 

Hi,

I want to call a back-end function from javascript, using a full postback. To do this, i've created a hidden <asp:linkbutton>, with in the back-end a 'handles buttonid.click'.

Next, in my javascript, i call __doPostBack('buttonid', '') (of course with the real id, using button.clientid, no problem there). Yes, i call this after the button has loaded, no problem in html order.

Doing this gives me an error (sorry for the length of it):

InnerException: Exception has been thrown by the target of an invocation.
FileName
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject
Message: DotNetNuke.Services.Exceptions.PageLoadException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Invalid JSON primitive: . at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject() at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at DotNetNuke.UI.Utilities.Reflection.InvokeGenericMethod[T](Type Type, String MethodName, Object Target, Object[] Args) at DotNetNuke.UI.Utilities.MSAJAX.Deserialize[T](String Data) at DotNetNuke.UI.Utilities.ClientAPI.GetClientVariableList(Page objPage) at DotNetNuke.UI.Utilities.ClientAPI.GetClientVariableNameValuePair(Page objPage, String strVar) at DotNetNuke.UI.Utilities.ClientAPI.GetClientVariable(Page objPage, String strVar) at DotNetNuke.UI.WebControls.DNNMenu.LoadPostedJSON() at DotNetNuke.UI.WebControls.DNNMenu.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at DotNetNuke.UI.Skins.NavObjectBase.InitializeNavControl(Control objParent, String strDefaultProvider) in C:\dotnetnuke\Library\UI\Skins\NavObjectBase.vb:line 1094 at DotNetNuke.UI.Skins.Controls.Nav.OnInit(EventArgs e) in C:\dotnetnuke\Website\Admin\Skins\Nav.ascx.vb:line 177 at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at DotNetNuke.Framework.DefaultPage.Page_Init(Object sender, EventArgs e) in C:\dotnetnuke\Website\Default.aspx.vb:line 492 at System.Web.UI.Control.OnInit(EventArgs e) at System.Web.UI.Page.OnInit(EventArgs e) at DotNetNuke.Framework.PageBase.OnInit(EventArgs e) in C:\dotnetnuke\Library\Framework\PageBase.vb:line 545 at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---


I'm using the standard DNN 5.0 minimalextropy skin. Maybe that has something to do with it?

I realise i could be using ajax instead of a full postback too, but in this case, i want the postback (a bunch of elements will be refreshed too, and it's my choice to have this as postback..)

Thanks in advance for any pointers.

 
New Post
3/6/2009 4:37 PM
 

Solved it. The issue was that i called the postback like this:

if (confirm("blabla")) {

  __doPostBack(<%=element.ClientId %>, "");

}

There are two issues with this code:

  1. it calls dopostback before the rest of the page has finished loading, which caused the error above. Solution: window.setTimeout(__doPostback...)
  2. using ClientId is incorrect. You must use UniqueId

I hope it helps for someone in the future.

 
New Post
3/6/2009 5:53 PM
 

 It doesn't apply to anything I'm doing now, but thank you for posting that. it's useful information I didn't have, but can see a use for later on.

 
New Post
9/24/2009 3:26 AM
 

This problem was driving me crazy... After a lot of googling, Finally I found this post.

 

Thanks a lot Tominator, Your solution is perfect

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem with calling dopostbackProblem with calling dopostback


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out