Solved

Void firing before changes

Posted on 2011-09-06
1
200 Views
Last Modified: 2012-05-12
I've got an asp.net page with a void that I run whenever one of two dropdowns chages. It does some counting and sets the datasource of a gridview for me. It's doing what I want...almost.

The problem is I've got some parameters which I attempt to set before I call it (UserName, Start and End Date). But, they don't actually change until after it runs. That happens on page_load and in any postbacks.   "On paper" my parameters are changed first. Bottom line, my counts and gridview appear to be one step behind.

I can get something almost right setting the void to run on an selected value changes in the two dropdowns, but my load event doesn't work that way.
0
Comment
Question by:jdcollins21
1 Comment
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 500 total points
ID: 36494155
Hi jdcollins21,
How you invoke the Postback code in page_load event, through client script or server script?
You can put the existing controls inside <asp:updatepanel>, call from Page_Load event(code behind).
eg:
Private Page_Load(){
  if(!IsPostBack){
    CallDropDownSelectedIndexChanged_Event(null,null);//call your selectedindexchanged event
  }
}

Or, you can call the client script manually.
<script language='Javascript'>
__doPostBack('__DrpDownListID', 'YourCustomArgument');
</script>
Sample:
http://www.dotnetspider.com/resources/1521-How-call-Postback-from-Javascript.aspx

But, this is depending how your control your flow and the way you invoke the script based on your real situation.
Please provide more details if you seek any further assistance.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now