Solved

Void firing before changes

Posted on 2011-09-06
1
203 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

16 Experts available now in Live!

Get 1:1 Help Now