protected void ddlcomplaints_SelectedIndexChanged(object sender, EventArgs e) { try { DropDownList ddlListFind = (DropDownList)sender; ListViewItem item1 = (ListViewItem)ddlListFind.NamingContainer; DropDownList ddlcomplaints = (DropDownList)item1.FindControl("ddlcomplaints"); if (ddlcomplaints.SelectedItem.Text != "Resolved") { Label tc_id = (Label)item1.FindControl("lbltc_id"); string tc_PropertyVal = Session["propertyvalue"].ToString(); SqlDataReader sdr1 = uc.GetOngoingComplaintsMsg(tc_PropertyVal); if (sdr1.HasRows) { if (sdr1.Read()) { Session["tc_Name"] = sdr1["tc_Name"].ToString(); Session["tc_RoomNo"] = sdr1["tc_RoomNo"].ToString(); Session["tc_Mobile"] = sdr1["tc_Mobile"].ToString(); Session["tc_MainIssueText"] = sdr1["tc_MainIssueText"].ToString(); Session["tc_issueText"] = sdr1["tc_issueText"].ToString(); Session["tc_subCatIssueText"] = sdr1["tc_subCatIssueText"].ToString(); Session["tc_message"] = sdr1["tc_message"].ToString(); Session["tc_status"] = ddlcomplaints.SelectedItem.Text; } sdr1.Close(); } uc.UpdateStatusComplaints(tc_id.Text, ddlcomplaints.SelectedItem.Text); SendMsgToTenantsComplaints(); SendMsgToManagerComplaints(); } else { Label tc_id = (Label)item1.FindControl("lbltc_id"); string tc_PropertyVal = Session["propertyvalue"].ToString(); SqlDataReader sdr1 = uc.GetResolvedComplaintsMsg(tc_PropertyVal); if (sdr1.HasRows) { if (sdr1.Read()) { Session["tc_Name"] = sdr1["tc_Name"].ToString(); Session["tc_RoomNo"] = sdr1["tc_RoomNo"].ToString(); Session["tc_Mobile"] = sdr1["tc_Mobile"].ToString(); Session["tc_MainIssueText"] = sdr1["tc_MainIssueText"].ToString(); Session["tc_issueText"] = sdr1["tc_issueText"].ToString(); Session["tc_subCatIssueText"] = sdr1["tc_subCatIssueText"].ToString(); Session["tc_message"] = sdr1["tc_message"].ToString(); Session["tc_status"] = ddlcomplaints.SelectedItem.Text; } sdr1.Close(); } uc.UpdateStatusComplaints(tc_id.Text, ddlcomplaints.SelectedItem.Text); SendMsgToTenantsresolveComplaints(); SendMsgToManagerComplaints(); } ShowNewcomplaints(); ShowOngoingcomplaints(); ShowResolvedcomplaints(); } catch (Exception ex) { string text = ex.Message.ToString(); ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false); } }