Problem retaining values of dropdownlist controls after postback

G

Guest

Hi,

Trouble in retaining values of dropdownlist, textboxes, and other
controls when
dropdownlist selectedindexchanged event is triggered, the controls are
inside a user control and this user control inside a parent user control with
an update panel. Can you guys help me hwo to retain the values. I have set
EnableViewState to true. Where is correct page event to store entered and
selected values before the values on controls are re-intialized.

Some of the codes:
protected override void OnLoad(EventArgs e)
{
....
this.UpdateContent();
base.OnLoad(e);

if (multiView.GetActiveView().ID == "viewInputForm")
{
if (Session["id"] != null)
ShowAssessmentDetails(Session["id"].ToString());
DisplayProcessedIconImage();
}
}

//All Dropdown SelectedIndexChanged Event
protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)
{
if (sender == this.ddlEmployee)
{
...
}
else if (sender == this.ddlCategory)
{
FillSubCategoryList();
FillCompetencyList();
}
else if (sender == this.ddlSubCategory)
{
if (ddlSubCategory.SelectedIndex != 0)
{
int subcat = Int32.Parse(ddlSubCategory.SelectedValue);

ddlCategory.SelectedValue = oAssessment.GetCategoryID(subcat);
FillSubCategoryList();
ddlSubCategory.SelectedValue = subcat.ToString();
if (subcat.ToString() != string.Empty && subcat.ToString() != "0")
ViewState["ddlSubCategory"] = subcat.ToString();
}

FillCompetencyList();
}
else if (sender == this.ddlCompetencyCode)
{
UpdateCompetencyList(1);
DoCourseCodeMatching();
}
else if (sender == this.ddlCompetency)
{
UpdateCompetencyList(2);
DoCourseCodeMatching();
}
else if (sender == this.ddlCourseCode)
{
ClearSuggestedTrainingData();
//FillTrainingData();
DoCourseCodeMatching();
}
else if (sender == this.ddlYear)
{
...
}
else if (sender == this.ddlCompetencyModel)
{
FillCategoryList();
FillSubCategoryList();
FillCompetencyList();
}
...
}

private void ShowAssessmentDetails(string idVal)
{
oAssessment.ID = Convert.ToInt32(idVal);
if (oAssessment.Get())
{
InitializeControls();
...

FillCompetencyModelList();//First Dropdown

....
FillEmployeeData();

try { ddlCompetencyModel.SelectedValue =
oAssessment.CompetencyModelID.ToString(); }
catch { ddlCompetencyModel.SelectedIndex = 0; }

FillCategoryList();//Second DropDown
FillSubCategoryList();//Third Dropdown
FillCompetencyList();//Fourth Dropdown
FillCourseCode();

ddlCompetency.SelectedValue = oAssessment.CompetencyID.ToString();
UpdateCompetencyList(2);

try { ddlCourseCode.SelectedValue =
oAssessment.CatalogueCourseID.ToString(); }
catch { ddlCourseCode.SelectedIndex = 0; }

....
FillSupervisorApproval(cbTrainingRequest.Checked);
FillLocalApproval(cbTrainingRequest.Checked);

ddlCSApproval.SelectedValue =
oAssessment.CompetencySupervisorApprovalID.ToString();
ddlCLApproval.SelectedValue =
oAssessment.CompetencyLocalApprovalID.ToString();


....

try { ddlSuggLocalTrainingType.SelectedValue =
oAssessment.SuggestedLocalTrainingType.ToString(); }
catch { ddlSuggLocalTrainingType.SelectedIndex = 0; }

tbLocalTrainingSuggest.Text = oAssessment.SuggestedLocalTraining;

try
{
ddlSuggTrainingType.SelectedValue =
oAssessment.SuggestedTrainingType.ToString();
tbSuggestedTraining.Text = oAssessment.SuggestedTraining;
}
catch
{
ddlSuggTrainingType.SelectedIndex = 0;
tbSuggestedTraining.Text = String.Empty;
}
....
}
}

private void InitializeControls()
{
...
FillCompetencyModelList();
...
FillCategoryList();
FillSubCategoryList();
FillCompetencyList();
FillSupervisorApproval(false);
FillLocalApproval(false);
...
FillCourseCode();
...
}

private void FillCompetencyModelList()
{
try
{
using (DataAccessLayer objDAL = new
DataAccessLayer("CompetencyModel_GetAllByYear"))
{
objDAL.AddParameter("Year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
ddlCompetencyModel.Items.Clear();
ddlCompetencyModel.Items.Add(new ListItem("-- select model --", "0"));
while (objDAL.DataReader.Read())
{
ddlCompetencyModel.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyModelID"])));
}
}
}
catch
{
ddlCompetencyModel.Items.Clear();
ddlCompetencyModel.Items.Add(new ListItem("-- select model --", "0"));
}
}

private void FillCompetencyList()
{
if (ddlCompetencyModel.SelectedIndex != 0)
{
try
{
ddlCompetencyCode.Items.Clear();
ddlCompetency.Items.Clear();
ddlCompetencyCode.Items.Add(new ListItem("-- select code --", "0"));
ddlCompetency.Items.Add(new ListItem("-- select competency --", "0"));

if (ddlCompetencyModel.SelectedIndex == 0)
{
if ((ddlSubCategory.SelectedValue != null) &&
(ddlSubCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetBySubCategoryIDAndYear"))
{
SqlParameter sqlparam = new SqlParameter("@subcat", SqlDbType.Int);
sqlparam.Value = ddlSubCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
else if ((ddlCategory.SelectedValue != null) &&
(ddlCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetByCategoryIDAndYear"))
{
SqlParameter sqlparam = new SqlParameter("@catid", SqlDbType.Int);
sqlparam.Value = ddlCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
else
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetAllByYear"))
{
objDAL.AddParameter("year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
}
else if (ddlCompetencyModel.SelectedIndex > 0)
{
if ((ddlSubCategory.SelectedValue != null) &&
(ddlSubCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetBySubCatIDModelYear"))
{
SqlParameter sqlparam = new SqlParameter("@subcat", SqlDbType.Int);
sqlparam.Value = ddlSubCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
sqlparam = new SqlParameter("@compmodelid", SqlDbType.Int);
sqlparam.Value = ddlCompetencyModel.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
else if ((ddlCategory.SelectedValue != null) &&
(ddlCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetByCatIDModelYear"))
{
SqlParameter sqlparam = new SqlParameter("@catid", SqlDbType.Int);
sqlparam.Value = ddlCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
sqlparam = new SqlParameter("@compmodelid", SqlDbType.Int);
sqlparam.Value = ddlCompetencyModel.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
else
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetAllByModelYear"))
{
objDAL.AddParameter("year", ddlYear.SelectedValue);
SqlParameter sqlparam = new SqlParameter("@compmodelid",
SqlDbType.Int);
sqlparam.Value = ddlCompetencyModel.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
}
}
catch
{
ddlCompetencyCode.Items.Clear();
ddlCompetency.Items.Clear();
ddlCompetencyCode.Items.Add(new ListItem("-- select code --", "0"));
ddlCompetency.Items.Add(new ListItem("-- select competency --", "0"));
}
}
else
{
ddlCompetencyCode.Items.Clear();
ddlCompetency.Items.Clear();
ddlCompetencyCode.Items.Add(new ListItem("-- select code --", "0"));
ddlCompetency.Items.Add(new ListItem("-- select competency --", "0"));
}
}

private void FillSubCategoryList()
{
try
{
if ((ddlCategory.SelectedValue != null) && (ddlCategory.SelectedValue !=
"0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("CompetencySubCategory_GetByCategoryID"))
{
SqlParameter sqlparam = new SqlParameter("@CatID", SqlDbType.Int);
sqlparam.Value = ddlCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.ExecuteReader();
ddlSubCategory.Items.Clear();
ddlSubCategory.Items.Add(new ListItem("-- select subcategory --", "0"));

if (ddlCompetencyModel.SelectedIndex != 0)
{
while (objDAL.DataReader.Read())
{
ddlSubCategory.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencySubCategoryID"])));
}
}
}
}
else
{
using (DataAccessLayer objDAL = new
DataAccessLayer("CompetencySubCategory_GetAll"))
{
objDAL.ExecuteReader();
ddlSubCategory.Items.Clear();
ddlSubCategory.Items.Add(new ListItem("-- select subcategory --", "0"));

if (ddlCompetencyModel.SelectedIndex != 0)
{
while (objDAL.DataReader.Read())
{
ddlSubCategory.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencySubCategoryID"])));
}
}
}
}
if (ViewState["ddlSubCategory"] != null && ddlSubCategory.Items.Count > 1)
{
ddlSubCategory.SelectedValue = ViewState["ddlSubCategory"].ToString();
ddlSubCategory.SelectedIndex =
ddlSubCategory.Items.IndexOf(ddlSubCategory.Items.FindByValue(ViewState["ddlSubCategory"].ToString()));

}
}
catch
{
ddlSubCategory.Items.Clear();
}
}
 
G

Guest

Hi,
You can store the values in hidden fields(probably in
dropdown-selectedindexchange event)
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



den 2005 said:
Hi,

Trouble in retaining values of dropdownlist, textboxes, and other
controls when
dropdownlist selectedindexchanged event is triggered, the controls are
inside a user control and this user control inside a parent user control with
an update panel. Can you guys help me hwo to retain the values. I have set
EnableViewState to true. Where is correct page event to store entered and
selected values before the values on controls are re-intialized.

Some of the codes:
protected override void OnLoad(EventArgs e)
{
....
this.UpdateContent();
base.OnLoad(e);

if (multiView.GetActiveView().ID == "viewInputForm")
{
if (Session["id"] != null)
ShowAssessmentDetails(Session["id"].ToString());
DisplayProcessedIconImage();
}
}

//All Dropdown SelectedIndexChanged Event
protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)
{
if (sender == this.ddlEmployee)
{
...
}
else if (sender == this.ddlCategory)
{
FillSubCategoryList();
FillCompetencyList();
}
else if (sender == this.ddlSubCategory)
{
if (ddlSubCategory.SelectedIndex != 0)
{
int subcat = Int32.Parse(ddlSubCategory.SelectedValue);

ddlCategory.SelectedValue = oAssessment.GetCategoryID(subcat);
FillSubCategoryList();
ddlSubCategory.SelectedValue = subcat.ToString();
if (subcat.ToString() != string.Empty && subcat.ToString() != "0")
ViewState["ddlSubCategory"] = subcat.ToString();
}

FillCompetencyList();
}
else if (sender == this.ddlCompetencyCode)
{
UpdateCompetencyList(1);
DoCourseCodeMatching();
}
else if (sender == this.ddlCompetency)
{
UpdateCompetencyList(2);
DoCourseCodeMatching();
}
else if (sender == this.ddlCourseCode)
{
ClearSuggestedTrainingData();
//FillTrainingData();
DoCourseCodeMatching();
}
else if (sender == this.ddlYear)
{
...
}
else if (sender == this.ddlCompetencyModel)
{
FillCategoryList();
FillSubCategoryList();
FillCompetencyList();
}
...
}

private void ShowAssessmentDetails(string idVal)
{
oAssessment.ID = Convert.ToInt32(idVal);
if (oAssessment.Get())
{
InitializeControls();
...

FillCompetencyModelList();//First Dropdown

....
FillEmployeeData();

try { ddlCompetencyModel.SelectedValue =
oAssessment.CompetencyModelID.ToString(); }
catch { ddlCompetencyModel.SelectedIndex = 0; }

FillCategoryList();//Second DropDown
FillSubCategoryList();//Third Dropdown
FillCompetencyList();//Fourth Dropdown
FillCourseCode();

ddlCompetency.SelectedValue = oAssessment.CompetencyID.ToString();
UpdateCompetencyList(2);

try { ddlCourseCode.SelectedValue =
oAssessment.CatalogueCourseID.ToString(); }
catch { ddlCourseCode.SelectedIndex = 0; }

....
FillSupervisorApproval(cbTrainingRequest.Checked);
FillLocalApproval(cbTrainingRequest.Checked);

ddlCSApproval.SelectedValue =
oAssessment.CompetencySupervisorApprovalID.ToString();
ddlCLApproval.SelectedValue =
oAssessment.CompetencyLocalApprovalID.ToString();


....

try { ddlSuggLocalTrainingType.SelectedValue =
oAssessment.SuggestedLocalTrainingType.ToString(); }
catch { ddlSuggLocalTrainingType.SelectedIndex = 0; }

tbLocalTrainingSuggest.Text = oAssessment.SuggestedLocalTraining;

try
{
ddlSuggTrainingType.SelectedValue =
oAssessment.SuggestedTrainingType.ToString();
tbSuggestedTraining.Text = oAssessment.SuggestedTraining;
}
catch
{
ddlSuggTrainingType.SelectedIndex = 0;
tbSuggestedTraining.Text = String.Empty;
}
....
}
}

private void InitializeControls()
{
...
FillCompetencyModelList();
...
FillCategoryList();
FillSubCategoryList();
FillCompetencyList();
FillSupervisorApproval(false);
FillLocalApproval(false);
...
FillCourseCode();
...
}

private void FillCompetencyModelList()
{
try
{
using (DataAccessLayer objDAL = new
DataAccessLayer("CompetencyModel_GetAllByYear"))
{
objDAL.AddParameter("Year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
ddlCompetencyModel.Items.Clear();
ddlCompetencyModel.Items.Add(new ListItem("-- select model --", "0"));
while (objDAL.DataReader.Read())
{
ddlCompetencyModel.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyModelID"])));
}
}
}
catch
{
ddlCompetencyModel.Items.Clear();
ddlCompetencyModel.Items.Add(new ListItem("-- select model --", "0"));
}
}

private void FillCompetencyList()
{
if (ddlCompetencyModel.SelectedIndex != 0)
{
try
{
ddlCompetencyCode.Items.Clear();
ddlCompetency.Items.Clear();
ddlCompetencyCode.Items.Add(new ListItem("-- select code --", "0"));
ddlCompetency.Items.Add(new ListItem("-- select competency --", "0"));

if (ddlCompetencyModel.SelectedIndex == 0)
{
if ((ddlSubCategory.SelectedValue != null) &&
(ddlSubCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetBySubCategoryIDAndYear"))
{
SqlParameter sqlparam = new SqlParameter("@subcat", SqlDbType.Int);
sqlparam.Value = ddlSubCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
else if ((ddlCategory.SelectedValue != null) &&
(ddlCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetByCategoryIDAndYear"))
{
SqlParameter sqlparam = new SqlParameter("@catid", SqlDbType.Int);
sqlparam.Value = ddlCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
else
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetAllByYear"))
{
objDAL.AddParameter("year", ddlYear.SelectedValue);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
}
else if (ddlCompetencyModel.SelectedIndex > 0)
{
if ((ddlSubCategory.SelectedValue != null) &&
(ddlSubCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetBySubCatIDModelYear"))
{
SqlParameter sqlparam = new SqlParameter("@subcat", SqlDbType.Int);
sqlparam.Value = ddlSubCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
sqlparam = new SqlParameter("@compmodelid", SqlDbType.Int);
sqlparam.Value = ddlCompetencyModel.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
Convert.ToString(objDAL.DataReader["CompetencyID"])));
ddlCompetency.Items.Add(new
ListItem(MultiLanguageField.GetFieldValue(Convert.ToString(objDAL.DataReader["Name"])), Convert.ToString(objDAL.DataReader["CompetencyID"])));
}
}
}
else if ((ddlCategory.SelectedValue != null) &&
(ddlCategory.SelectedValue != "0"))
{
using (DataAccessLayer objDAL = new
DataAccessLayer("Competency_GetByCatIDModelYear"))
{
SqlParameter sqlparam = new SqlParameter("@catid", SqlDbType.Int);
sqlparam.Value = ddlCategory.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.AddParameter("year", ddlYear.SelectedValue);
sqlparam = new SqlParameter("@compmodelid", SqlDbType.Int);
sqlparam.Value = ddlCompetencyModel.SelectedValue;
objDAL.AddParameter(sqlparam);
objDAL.ExecuteReader();
while (objDAL.DataReader.Read())
{
ddlCompetencyCode.Items.Add(new
ListItem(Convert.ToString(objDAL.DataReader["CompetencyCode"]),
 
M

Muhammad Naveed Yaseen

It may be occuring for either one of two probable reasons.

1) You may be switching active view of MultiView between posts, which
may be causing state of some items in inactive views being lost across
post. In this case you may want to use something other than MultiView
(e.g. div with style="display:none/block").
2) Some parent in hierarchy of your control may have viewstate
disabled.

(if you are using FormView, also make sure it is not switching
apparently similar looking insert/update modes)
 
G

Guest

Thanks Manish and Muhammad,

This problem has been resolved...

A co-worker has helped solved this problem.

string postBackTrigger = Request.Params["__EVENTTARGET"];
if (postBackTrigger.Contains(ddlCategory.UniqueID))
{
category = Request.Form[ddlCategory.UniqueID].Tostring() ?? "0";
}

den2005
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top