Hi,
I have 3 dropdownlist controls.. To load i have written a method placed in a separate class which is static.
Here is the method and the page load event.. The master page again loads back erasing all the data to be displayed in the dropdownlist control.. Plzz help me correct me..
this is xyz.aspx:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
load_dropdownlist();
}
}
private void load_dropdownlist()
{
DataSet ds = new DataSet();
ds = PopulateControlsCls.LoadDataSet("Select ProjectID,ProjectName from ProjectDetailsMaster");
drpprojname.DataSource = ds.Tables[0];
drpprojname.DataValueField = "ProjectID";
drpprojname.DataTextField = "ProjectName";
}
==========================================================================
PopulateControlsCls is static class
public static DataSet LoadDataSet(string SQLquery)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProjectTrackingConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
DataSet ds = new DataSet();
//conn = CONN;
cmd.CommandType = CommandType.Text;
cmd.CommandText = SQLquery;
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.Connection = conn;
da.SelectCommand = cmd;
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.Fill(ds);
conn.Close();
cmd = null;
return ds;
}
Loading
Suthish NairPosted Jun 22, 2011, 2:39 PM
Pradeep ChandrakerPosted Jun 22, 2011, 9:48 AM
http://forums.asp.net/t/1256336.aspx/1
http://forums.asp.net/p/1079254/1593913.aspx
If you still have the issue, try to remove code one by one and debug it.