protected void FillFileAttachDetail() { //dt = new DataTable(); //Int32 MsgId; //MsgId = 0; //DataTable dtMain = new DataTable(); //Int32 MsgDetailId = Convert.ToInt32(Request.QueryString["MsgDetailId"]); //dt = clsMessage.SelectMsgIdUsingMsgDetailId(MsgDetailId); //// if (dt.Rows.Count > 0) //// { //// MsgId = Convert.ToInt32(Request.QueryString["MsgId"]); //if (dt.Rows.Count > 0) //{ Int32 MsgId = Convert.ToInt32(Request.QueryString["MsgId"]); dt = new DataTable(); dt = clsMessage.SelectMsgforFileAttachExt(MsgId); if (dt.Rows.Count > 0) { GrdFileList.DataSource = dt; GrdFileList.DataBind(); lblAttachment.Visible = false; setGridisze(); } // } else { lblAttachment.Visible = true; } // } }
protected void FillFileAttachDetail() { dt = new DataTable(); Int32 MsgId; MsgId = 0; DataTable dtMain = new DataTable(); Int32 MsgDetailId = Convert.ToInt32(Request.QueryString["MsgDetailId"]); dt = clsMessage.SelectMsgIdUsingMsgDetailIdExt(MsgDetailId); if (dt.Rows.Count > 0) { MsgId = Convert.ToInt32(dt.Rows[0]["MsgId"].ToString()); dt = new DataTable(); dt = clsMessage.SelectMsgforFileAttachExt(MsgId); if (dt.Rows.Count > 0) { GrdFileList.DataSource = dt; GrdFileList.DataBind(); // DataList1.DataSource = dt; // DataList1.DataBind(); setGridisze(); } } }
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.SelectMsgDetailforSentPartyListExt(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(); } else { SqlDataAdapter daaaa = new SqlDataAdapter("select ToEmailID from " + PageConn.extmsg11 + ".dbo.MsgDetailExt where MsgId='" + MsgId + "'", con); DataTable dtaaa = new DataTable(); daaaa.Fill(dtaaa); if (dtaaa.Rows.Count > 0) { sentTo.Text = Convert.ToString(dtaaa.Rows[0]["ToEmailID"]); } } dtMain = new DataTable(); dtMain = clsMessage.SelectMsgforFileAttachExt(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(); } }