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(dt.Rows[0]["MsgId"].ToString());
            dt    = new DataTable();
            dt    = clsMessage.SelectMsgforFileAttach(MsgId);
            if (dt.Rows.Count > 0)
            {
                GrdFileList.DataSource = dt;
                GrdFileList.DataBind();
                //   DataList1.DataSource = dt;
                // DataList1.DataBind();
                setGridisze();
            }
        }
    }
Example #2
0
 protected void gridInbox_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         ////
         if (DataBinder.Eval(e.Row.DataItem, "MsgStatusName").ToString() == "UNREAD")
         {
             e.Row.Cells[5].ForeColor = System.Drawing.Color.Red;
             e.Row.Cells[5].Font.Bold = true;
         }
         Int32     MsgId       = 0;
         DataTable dtMain      = new DataTable();
         Int32     MsgDetailId = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "MsgDetailId").ToString());
         dtMain = clsMessage.SelectMsgIdUsingMsgDetailId(MsgDetailId);
         if (dtMain.Rows.Count > 0)
         {
             MsgId  = Convert.ToInt32(dtMain.Rows[0]["MsgId"].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 (gridInbox.Rows.Count > 0)
         {
             CheckBox cbHeader = (CheckBox)gridInbox.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 gridInbox.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();
     }
 }