Can anyone tell me why I am getting 2 calls to my SelectedIndexCh ange
event.
public class Browse : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Data Grid DataGrid1;
protected System.Web.UI.W ebControls.Drop DownList DropDownConf;
protected DataSet BrowseOrders=nu ll;
protected int ConfID;
private void Page_Load(objec t sender, System.EventArg s e)
{
if ( Session["ConfID"]==null)
Session["ConfID"] = 3;
if (!IsPostBack)
{
BindData(null);
}
//Conference Dropdown Menu
DataSet conferences = RegCache.Confer enceList();
DropDownConf.Da taTextField = "ConfName";
DropDownConf.Da taValueField = "ConfID";
DropDownConf.Da taSource = conferences;
DropDownConf.Da taBind();
ListItem item = new ListItem("- Choose Conference -", "");
DropDownConf.It ems.Insert(0,it em);
}
private void BindData (string orderBy)
{
ConfID = Convert.ToInt32 (Session["ConfID"]);
orderBy =(orderBy==null )?"OrderID":ord erBy;
DataSet ds = null;
if (ViewState["BrowseData Set"]==null)
{
ds = Data.DataAccess .BrowseOrders(C onfID); //create data set and add
to view state
ViewState.Add(" BrowseDataSet", ds);
ds.Tables[0].DefaultView.So rt=orderBy;
}
else
{
ds=(DataSet)Vie wState["BrowseData Set"]; //get data set from view
state
ds.Tables[0].DefaultView.So rt=orderBy;
}
DataGrid1.DataS ource = ds.Tables[0].DefaultView;
DataGrid1.DataB ind();
}
public void SortDataGrid(Ob ject sender, DataGridSortCom mandEventArgs
e)
{
BindData(e.Sort Expression);
}
#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.DropDownCo nf.SelectedInde xChanged += new
System.EventHan dler(this.DropD ownConf_Selecte dIndexChanged);
this.Load += new System.EventHan dler(this.Page_ Load);
}
#endregion
public void DropDownConf_Se lectedIndexChan ged(object sender,
System.EventArg s e)
{
Session["ConfID"] = DropDownConf.Se lectedItem.Valu e;
ViewState.Remov e("BrowseDataSe t");
BindData(null);
}
}
Thanks,
Paul
*** Sent via Developersdex http://www.developersdex.com ***