S
sweetcheeks
Guest
I have an asp.net page with two databound dropdownlists. I also have two asp:button that will redirect the user to a new page (not associated with the dropdownlists). The only problem is, is that when I have both dropdownlists bound with a datareader, the buttons will not respond to a click – they are clicked but nothing happens. I checked and they onClick events are all correct. What has me confused is that when I comment out one dropdownlist binding, but leave the other, the buttons work. But with both lists bound, the buttons don’t work.
Is there any reason for this? I am really lost on this one. The code is below.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace DenOpPlan
{
public partial class admin_greeting : System.Web.UI.Page
{
public void Page_Load(object sender, EventArgs e)
{
if ( !Page.IsPostBack )
{
EditPMLoad();
EditAnalystLoad();
}
} //END Page_Load
protected void EditPMLoad()
{
SqlDataReader drEditPM = null;
SqlConnection conPlan = new SqlConnection(connectionString.ConnectionString);
SqlCommand cmdPlan = new SqlCommand("SELECT PMID, PerfWorkload FROM PerfMeasures ORDER BY PMID", conPlan);
conPlan.Open();
drEditPM = cmdPlan.ExecuteReader(CommandBehavior.CloseConnection);
ddlEditPM.DataSource = drEditPM;
ddlEditPM.DataTextField = "PerfWorkload";
ddlEditPM.DataBind();
}
protected void EditAnalystLoad()
{
SqlDataReader drEditAnalyst = null;
SqlConnection conPlan = new SqlConnection(connectionString.ConnectionString);
SqlCommand cmdAnalyst = new SqlCommand("SELECT AnalystID, FirstName + ' ' + LastName AS AnalystName FROM Analyst ORDER BY LastName", conPlan);
conPlan.Open();
drEditAnalyst = cmdAnalyst.ExecuteReader(CommandBehavior.CloseConnection);
ddlEditAnalyst.DataSource = drEditAnalyst;
ddlEditAnalyst.DataTextField = "AnalystName";
ddlEditAnalyst.DataBind();
}
public void btnGoToNewPM_Click(object sender, EventArgs e)
{
Response.Redirect("admin_newpm.aspx");
}
public void btnGoToNewAnalyst_Click(object sender, EventArgs e)
{
Response.Redirect("admin_newanalyst.aspx");
}
} //END CLASS admin_greeting
} //END Namespace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could the problem be from the datareader?
Thanks for any help with this problem! ^__^
Is there any reason for this? I am really lost on this one. The code is below.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace DenOpPlan
{
public partial class admin_greeting : System.Web.UI.Page
{
public void Page_Load(object sender, EventArgs e)
{
if ( !Page.IsPostBack )
{
EditPMLoad();
EditAnalystLoad();
}
} //END Page_Load
protected void EditPMLoad()
{
SqlDataReader drEditPM = null;
SqlConnection conPlan = new SqlConnection(connectionString.ConnectionString);
SqlCommand cmdPlan = new SqlCommand("SELECT PMID, PerfWorkload FROM PerfMeasures ORDER BY PMID", conPlan);
conPlan.Open();
drEditPM = cmdPlan.ExecuteReader(CommandBehavior.CloseConnection);
ddlEditPM.DataSource = drEditPM;
ddlEditPM.DataTextField = "PerfWorkload";
ddlEditPM.DataBind();
}
protected void EditAnalystLoad()
{
SqlDataReader drEditAnalyst = null;
SqlConnection conPlan = new SqlConnection(connectionString.ConnectionString);
SqlCommand cmdAnalyst = new SqlCommand("SELECT AnalystID, FirstName + ' ' + LastName AS AnalystName FROM Analyst ORDER BY LastName", conPlan);
conPlan.Open();
drEditAnalyst = cmdAnalyst.ExecuteReader(CommandBehavior.CloseConnection);
ddlEditAnalyst.DataSource = drEditAnalyst;
ddlEditAnalyst.DataTextField = "AnalystName";
ddlEditAnalyst.DataBind();
}
public void btnGoToNewPM_Click(object sender, EventArgs e)
{
Response.Redirect("admin_newpm.aspx");
}
public void btnGoToNewAnalyst_Click(object sender, EventArgs e)
{
Response.Redirect("admin_newanalyst.aspx");
}
} //END CLASS admin_greeting
} //END Namespace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could the problem be from the datareader?
Thanks for any help with this problem! ^__^