protected void GetMessgeDetail() { dt = new DataTable(); Int32 MsgId = Convert.ToInt32(Request.QueryString["MsgId"]); dt = clsMessage.SelectMsgDetailforSentPartyList(MsgId); if (dt.Rows.Count > 0) { String ToList = ""; int i = 0; foreach (DataRow DR in dt.Rows) { if (i >= 1) { ToList = ToList + " , " + DR["compname"].ToString(); } if (i == 0) { ToList = DR["compname"].ToString(); i = 1; } } lblto.Text = ToList; } Int32 MsgDetailId = Convert.ToInt32(dt.Rows[0]["MsgDetailId"].ToString()); dt = new DataTable(); dt = clsMessage.SelectMsgforDetail(MsgDetailId); if (dt.Rows.Count > 0) { lblFrom.Text = dt.Rows[0]["compname"].ToString(); lblsubject.Text = dt.Rows[0]["MsgSubject"].ToString(); lblmessage.Text = dt.Rows[0]["MsgDetail"].ToString(); lbldate.Text = dt.Rows[0]["MsgDate"].ToString(); } }
protected void grdSentMailList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Int32 MsgId = 0; DataTable dtMain = new DataTable(); MsgId = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "MsgId").ToString()); // dtMain = new DataTable(); dtMain = clsMessage.SelectMsgDetailforSentPartyList(MsgId); Label sentTo = (Label)e.Row.FindControl("lblSentTo"); if (dtMain.Rows.Count > 0) { String ToList = ""; int i = 0; foreach (DataRow DR in dtMain.Rows) { if (i >= 1) { ToList = ToList + " , " + DR["CompName"].ToString(); } if (i == 0) { ToList = DR["CompName"].ToString(); i = 1; } if (ToList.Length > 25) { ToList = ToList + " ...."; break; } } sentTo.Text = ToList.ToString(); } // dtMain = new DataTable(); dtMain = clsMessage.SelectMsgforFileAttach(MsgId); Image img = (Image)e.Row.FindControl("ImgFile"); if (dtMain.Rows.Count > 0) { img.ImageUrl = "~/Account/images/attach.png"; img.Visible = true; } else { img.ImageUrl = ""; img.Visible = false; } } try { if (grdSentMailList.Rows.Count > 0) { CheckBox cbHeader = (CheckBox)grdSentMailList.HeaderRow.FindControl("HeaderChkbox"); cbHeader.Attributes["onclick"] = "ChangeAllCheckBoxStates(this.checked);"; List <string> ArrayValues = new List <string>(); ArrayValues.Add(string.Concat("'", cbHeader.ClientID, "'")); foreach (GridViewRow gvr in grdSentMailList.Rows) { CheckBox cb = (CheckBox)gvr.FindControl("chkMsg"); cb.Attributes["onclick"] = "ChangeHeaderAsNeeded();"; ArrayValues.Add(string.Concat("'", cb.ClientID, "'")); } CheckBoxIDsArray.Text = "<script type='text/javascript'>" + "\n" + "<!--" + "\n" + String.Concat("var CheckBoxIDs = new Array(", String.Join(",", ArrayValues.ToArray()), ");") + "\n // -->" + "\n" + "</script>"; } else { } } catch (Exception ex) { pnlmsg.Visible = true; lblmsg.Text = "Error in databound : " + ex.Message.ToString(); } }