dodgerfan
asked on
ASP.Net Gridview behavior after update
I have an ASP.Net page (C# code behind, Access database) that displays 4 girdviews. I have two columns, side by side. The left column has starters on top, bench on bottom for batter (it's a baseball site). The right column has starters on top and bench on bottom for pitchers. The pitchers each have a button in their row, "Bench" in the starters gird, "Start" on the bench grid. Cliking this button changes a value in the underlying table in the starter field to 1 for starter, 0 for bench, When clicked the player is moved to the opposite grid, immediately. The grid displays the update very qucikly without a complete page refresh. These work fine. The batters grids do work properly. The batter bench grid also has a dropdownlist, an update button and a start button. The drop downlist displays all of the positions a player is quaified for. The user picks one, then clicks the update button to update the positinon. This seems to work, but its gets flaky at times so I'm not sure if its completely correct. If you click the Start button in the batter bench grid, he is moved to the Starter gird immeediately. But, if youbench someone from the starter gird, he is removed from starters but is not displayed in the bench. You have to completely refresh the page. I want the batter grids to behave as the pitcher grids do, displaying the changes immeditately without having to refresh the page. If possible, I would also prefer to have the batter bench grid dropdownlist update the table without having to click the update button. Is that possible? I've attached the code for the page, and any help is appreciated. Default2.aspx Default2.aspx.cs
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
close enough.
ASKER
protected void ddlPos_SelectedIndexChange
{
AccessDataSource ac = new AccessDataSource();
GridView BenchGrid = (GridView)this.FindControl
String playerID = BenchGrid.DataKeys[int.Par
DropDownList ddlPos = (DropDownList)BenchGrid.Ro
ac.DataFile = "~/App_Data/BaseballXP_Wor
ac.UpdateCommand = "UPDATE vwBatterWorksheet SET PosNo = " + ddlPos.SelectedValue + " WHERE ID = " + playerID;
ac.UpdateCommandType = SqlDataSourceCommandType.T
ac.Update();
DataBind();
}