This is runtime image for my rendered web page I have inserted data in my sql server database, now I am trying to update those records so that changes can be made but when I populate textboxes using datatable functions its working fine but it does not populate selected "Program, Group and Class dropdownlists" from selected database value or selecteditems.
protected void campus_SelectedIndexChanged(object sender, EventArgs e)
{
program.DataSource = dm.getData("SELECT DISTINCT cpCampusCode, cpCamName, cpProgramCode, cpProgName From CampusPrograms Where cpCampusCode = '" + campus.SelectedValue + "'");
program.DataTextField = "cpProgName";
program.DataValueField = "cpProgramCode";
program.DataBind();
program.Items.Insert(0, new ListItem("Select Program", "0"));
}
protected void program_SelectedIndexChanged(object sender, EventArgs e)
{
Group.DataSource = dm.getData("Select DISTINCT a.ProgramCode, a.ProgramName, a.GroupCode AS GroupCode, a.GroupName AS GroupName from ProgramGroup a Inner Join CampusPrograms b ON b.cpProgramCode=a.ProgramCode Where b.cpProgramCode = '" + program.SelectedValue + "' Order by GroupName ASC");
Group.DataTextField = "GroupName";
Group.DataValueField = "GroupCode";
Group.DataBind();
Group.Items.Insert(0, new ListItem("Select Group", "0"));
}
protected void stdid_SelectedIndexChanged(object sender, EventArgs e)
{
Button1.Enabled = false;
UpdtBtn.Enabled = true;
DataTable dt = dm.getData("select * from StudentInquiry si inner join CampusPrograms a on si.iProgramCode=a.cpProgramCode Where si.inqID='" + stdid.SelectedValue + "'");
foreach (DataRow dr in dt.Rows)
{
doi.Text = "" + dr["iDateOfInquiry"];
campus.SelectedValue = "" + dr["iCamCode"];
program.SelectedValue = "" + dr["iProgramCode"];
Group.SelectedValue = "" + dr["iGroupCode"];
Class.SelectedItem.Text = "" + dr["iClassCode"];
stName.Text = "" + dr["iStName"];
stCnic.Text = "" + dr["iCnic"];
dob.Text = "" + dr["iDOB"];
birthCity.SelectedItem.Text = "" + dr["iPlaceOfBirth"];
sphone.Text = "" + dr["iPhoneNo"];
smobile.Text = "" + dr["iMobileNo"];
semail.Text = "" + dr["iEmailID"];
saddress.Text = "" + dr["iAddress"];
gender.SelectedItem.Text = "" + dr["iGender"];
Religion.SelectedItem.Text = "" + dr["iReligion"];
DropDownList2.SelectedItem.Text = "" + dr["iMaritalStatus"];
Countries.SelectedItem.Text = "" + dr["iNationality"];
ffname.Text = "" + dr["iFFName"];
flname.Text = "" + dr["iFLName"];
fmob.Text = "" + dr["iFMobile"];
fnic.Text = "" + dr["iFCnic"];
qua.SelectedItem.Text = "" + dr["iLastQualification"];
lastins.Text = "" + dr["iLastInstitute"];
pyear.SelectedItem.Text = "" + dr["iPassingYear"];
Grade.Text = "" + dr["iGrade"];
RadioButtonList1.SelectedValue = "" + dr["iSource"];
remarks.Text = "" + dr["iRemarks"];
}
}
Aucun commentaire:
Enregistrer un commentaire