469,929 Members | 1,381 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,929 developers. It's quick & easy.

Problem retaining values of dropdownlist controls after postback

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.ToStrin g();
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_GetBySubCategoryIDAndY ear"))
{
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_GetByCatego ryID"))
{
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();
}
}
--
MCP Year 2005, Philippines
Mar 9 '07 #1
3 9632
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" wrote:
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.ToStrin g();
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_GetBySubCategoryIDAndY ear"))
{
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"]),
Mar 9 '07 #2

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)

Mar 9 '07 #3
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

--
MCP Year 2005, Philippines
"Muhammad Naveed Yaseen" wrote:
>
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)

Mar 12 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by BW | last post: by
7 posts views Thread by Girish | last post: by
4 posts views Thread by =?Utf-8?B?R3JlZyBTdGV2ZW5z?= | last post: by
9 posts views Thread by Bob Malcoprs | last post: by
5 posts views Thread by AlexC | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.