Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Void firing before changes

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

837 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