protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["SelectedId"] != null) { string selectedUserId = Session["SelectedId"].ToString(); DataSet objDataSet = _objRepository.GetUser(selectedUserId); foreach (DataRow row in objDataSet.Tables[0].Rows) { lblName.Text = row["Name"].ToString(); string gender = row["Gender"].ToString(); lblState.Text = row["State"].ToString(); if (gender == "Male") { lblGender.Text = gender; } if (gender == "Female") { lblGender.Text = gender; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["SelectedId"] != null) { string selectedUserId = Session["SelectedId"].ToString(); DataSet objDataSet = _objRepository.GetUser(selectedUserId); txtName.Text = objDataSet.Tables[0].Rows[0]["Name"].ToString(); string gender = objDataSet.Tables[0].Rows[0]["Gender"].ToString(); string state = objDataSet.Tables[0].Rows[0]["State"].ToString(); foreach (ListItem item in RadioButtonList1.Items) { if (item.Text == gender) { item.Selected = true; } } DropDownList1.SelectedValue = state; //foreach (DataRow row in objDataSet.Tables[0].Rows) //{ // txtName.Text = row["Name"].ToString(); // string gender = row["Gender"].ToString(); // string state = row["State"].ToString(); // foreach (ListItem item in RadioButtonList1.Items) // { // if (item.Text == gender) // { // item.Selected = true; // } // } // DropDownList1.SelectedValue = state; //} } } }