User105364981 posted
i have an aspx file where it is using usercontrol file.
on the dropdown selected index changed i am calling getdetails() method. where it calls data back from database and assing to controls
in the dropdown !=1 means which is already saved in database and now i am trying to populate the values back from the database to these controls.
if (ddldetails.SelectedIndex != 1)
{
GetDetails();
((UC)ASPxNavBar1.Items[0].FindControl("ucEmployee")).FillData();
((UpdatePanel)ASPxNavBar1.Items[0].FindControl("upPnlGridReq")).Update();
}
The issue is that when i debug the code i am able to see values in getdetails() but when it goes to next method filldata on user control Session["CompleteList"] is null. looks like here we are assingned in a variable but in getdetails i am assigning directly
is this the issue? thats why i am seeing the session as null in filldata method?
void GetDetails()
{
DataTable dt = new DataTable();
dt = blala(where we call database SP by passing params and puling data)
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["ControlName"].ToString() == "ID")
{
Session["ID"] = dt.Rows[i]["ControlValue"];
}
else if (dt.Rows[i]["ControlName"].ToString() == "IDName")
{
Session["IDName"] = dt.Rows[i]["ControlValue"];
}
}
}
usercontrol-
public void FillData()
{
if ((Session["CompleteList"] != null))
{
var CompleteList = (List<KeyValuePair<string, string>>)Session["CompleteList"];
foreach (KeyValuePair<string, string> completelist in CompleteList)
if ((txtID.Text.Trim() == string.Empty) && (completelist .Key.Contains("scWUID")))
txtID.Text = CompleteList.Value;
if ((txtEmpID.Text.Trim() == string.Empty) && (activitySearchList.Key.Contains("EmployeeID")))
txtEmpID.Text = CompleteList.Value;