Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Button click event comes after GridView bind
Message
From
06/06/2011 12:52:15
Don Harris
Iu Athletics Computer Services
Indiana, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Button click event comes after GridView bind
Miscellaneous
Thread ID:
01513130
Message ID:
01513130
Views:
155
Hi all,
I don't know if this is because I'm binding to an entitylist or if it's something dumb I'm doing.

I have a button that triggers a search and then should populate a gridview with the entitylist of that search. However,
I cannot get it to bind to the data in the click event of the button. If I click the button, the first time through
nothing happens. If I click it the second time, it populates fine. The data is always one click behind the
button. As you can see I've tried binding and rebinding all over the place but I seem to be missing some
clue about the page life cycle or binding in general.

I'm also posting a link I found of someone having the same issue but the answers don't seem to be applying.
That's why I'm posting here. Is this something particular to mm.net?

I know I have to be missing something simple. Have to be.

Have a great day!

Don
         protected void Page_Load(object sender, EventArgs e)
         {

            if (IsPostBack)
            {
                foreach (string item in Session.Contents)
                {
                    switch (item)
                    {
                        case "CarryForwardIsYes":
                         this.oAthlEligibility0.EntityList = GetEntityListFromSession<AthlEligibilityEntity>("CarryForwardIsYes");
                         break;
                           ...
                     {
        
              }
 
           grdMovNxtYrYes.DataSource = this.oAthlEligibility0.EntityList;
           grdMovNxtYrYes.DataBind();
         }


       protected void btnMoveToNewYear_Click(object sender, EventArgs e)
        {
            string sourceyear = "2010";
            string targetyear = "2011";

            AthlEligMovStudToNewYr movRes = new AthlEligMovStudToNewYr(sourceyear, targetyear);
            this.oAthlEligibility0.EntityList = movRes.CarryForwardIsYes; 
 
             grdMovNxtYrYes.DataBind(); 
             grdMovNxtYrYes.Rebind();
             Page.DataBind();
            //shoot me!
  
         }


http://stackoverflow.com/questions/552000/asp-net-page-events-button-click-event-comes-after-gridview-bind
Next
Reply
Map
View

Click here to load this message in the networking platform