Sign in to follow this  
aauman

__doPostBack arguments

Recommended Posts

Hello, having a bit of a problem with the __doPostBack call. I've modified the AJAX example to allow multiple arguments to be passed by appending the args with a delimiter ($) and splitting on that:

 

 

 

__doPostBack("control", "drillDown$1$2$3");

 

 

 

On the back end, I have:

 

 

 

Int32 iDelimiter = sEventArguments.IndexOf('$');

 

String sArgument = sEventArguments.Substring(iDelimiter + 1);

 

string[] args = sEventArguments.Split('$');

 

 

 

I can then access the individual values (1,2,3) via args[1], args[2], and args[3]. This works fine for numbers, but for some reason it is failing when I change any of the numbers to a string. For example, this fails:

 

 

 

__doPostBack("control", "drillDown$a$2$3");

 

 

 

I'm not sure why it's failing and was hoping someone could point this out. I don't believe it's even calling the postback since I put a panel.Controls.Clear() call at the very top of the postback event. Works fine if I change everything to numbers.

 

 

 

Any thoughts? I'd rather not have to retool this to work with an int.

Share this post


Link to post
Share on other sites

Just found the following.. which is interesting. Changing the arguments to:

 

 

 

drill$AB$3$28

 

 

 

works, but having drillDown$AB$3$28 does not. drillDow$AB$3$28 does. Bizarre. I've renamed it to just 'drill' and it works fine. No idea why.

Share this post


Link to post
Share on other sites
Guest Rajroop

Hello Aauman,

 

 

 

Thats great! ;)

 

 

 

We're currently looking into this. :)

Share this post


Link to post
Share on other sites

Hi,

I our lab, things are working fine.

What I would suggest is to debug what you are getting in the argument.

For the time being comment all code that calls up drillDown function.

First see what argument you are getting in sEventArguments.

1. Add this line:

Panel1.Controls.Clear();

Panel1.Controls.Add(new LiteralControl(sEventArguments));

2. Next if you are sure that you are getting correct values pass on to next step. Otherwize please check what exactly is being passed in __doPostback()

string[] args = sEventArguments.Split('$');

Panel1.Controls.Clear();

Panel1.Controls.Add(new LiteralControl(String.Join("-",args)));

This would show you exactly what is being split.

3. Are you still using this condition?

if

(sEventArguments.StartsWith("drillDown"))

You can also try with

if

(args[0].Equals("drillDown"))

Please feed us back.

Share this post


Link to post
Share on other sites

Bizarre stuff. I put this line in to the PostBack:

 

 

 

if (IsPostBack)

 

{

 

String sEventArguments = Request["__EVENTARGUMENT"];

 

pnlGrid.Controls.Clear();

 

pnlGrid.Controls.Add(new LiteralControl(sEventArguments));

 

}

 

 

 

In the drillDown javascript code, I have an alert that is firing just before it calls __doPostBack. Since that is firing, I know that javascript is being called. Furthermore, I can rename the first argument to anything else. Just "drillDown" doesn't work. In fact "drilldown" does work (all lowercase). I get this for the args:

 

 

 

drilldown$PV$2$28

 

 

 

Fails in both FF and IE. At this point, I'm not really concerned since I can just rename it. But yeah, I'm left scratching my head. I'm wondering if there's something cached somewhere. Oh well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this