Solved

Void firing before changes

Posted on 2011-09-06
1
208 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
[X]
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
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Calculating percentage 2 49
Build a string of emails from a gridview 2 31
Left aligned $ and right aligned amount ASP.NET 7 45
Javascript function 3 21
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…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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