private void binddata()
{
DataSet dt = objTYMemoDTM.GetTymemoDetails();
string side = "";
//string gridbind = "";
StringBuilder htmlTablenew = new StringBuilder();
StringBuilder htmlTable = new StringBuilder();
htmlTablenew.Append("<table border='1' cellpadding=4 cellspacing=0>");
for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
{
byte[] bytes = (byte[])dt.Tables[0].Rows[i]["SIGN"];
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
if (dt.Tables[0].Rows.Count > 0)
{
string[] DTM = dt.Tables[0].Rows[0]["DTM_No"].ToString().Split('/');
if (dt.Tables[0].Rows[0]["DTM_Type"].ToString().ToUpper() == "LEAVE")
{
spanleave.Visible = true;
spantyduty.Visible = false;
}
else
{
spanleave.Visible = false;
spantyduty.Visible = true;
}
side += "<table align='center'><tr><td align='center'><h4><label id='lbldivision' runat='server'>xxx/yyyy</label>TY MEMO NO.<label id='lblDTMNO' runat='server'>xxx/yyyy</label></h4></td></tr><tr><td align='center'><h4>DUTIES OF OFFICERS</h4></td></tr></table>";
//string OffcNames = "";
side += "<table id='tdi' runat='server'><tr><td align='center'><h4><tr><td align='left'><ol type='1'><li>During the absence of ";
side += lblabsencerankname.InnerText = DTM[0] + ",proceeding on <span runat='server' id='spanleave'>leave for ";
side += leavenoofdays.InnerText = dt.Tables[0].Rows[i]["No_of_FullDays"].ToString() + " days w.e.f.";
side += lblfromdate.InnerText = Convert.ToDateTime(dt.Tables[0].Rows[i]["FromDate"].ToString()).ToString("dd/MM/yyyy") + " with permission to prefix ";
side += lbltydutydate.InnerText = Convert.ToDateTime(dt.Tables[0].Rows[i]["FromDate"].ToString()).ToString("dd/MM/yyyy") + ",";
side += lblenroutedate.InnerText = Convert.ToDateTime(dt.Tables[0].Rows[i]["EnrouteClDate"].ToString()).ToString("dd/MM/yyyy") + " /suffix ";
side += lbltydutydate.InnerText = Convert.ToDateTime(dt.Tables[0].Rows[i]["FromDate"].ToString()).ToString("dd/MM/yyyy") + ",";
side += lbltydutydate.InnerText = Convert.ToDateTime(dt.Tables[0].Rows[i]["FromDate"].ToString()).ToString("dd/MM/yyyy") + " to ";
side += "(";
side += lblplace.InnerText = dt.Tables[0].Rows[i]["Place"].ToString() + ")" + ", the duties of (Role/Roles) are to be carried out by ";
side += lbldistrankname.InnerText = dt.Tables[0].Rows[i]["Distribution_Hsod_Name"].ToString() + "in addition to his own.";
side += "</li>";
side += "<li>This memo is self-cancelling on resumption of duties by ";
side += lblabsencerankname.InnerText = DTM[0];
side += "</li><br/><br/><br/>";
side += "</ol></td></tr><tr><td><table width='100%' cellpadding='2' cellspacing='2'><tr><td align='left' style='padding-left: 40px;'>";
side += "Distribution: <br />";
side += "[HSOD]";
side += lbldistrankname.InnerText = dt.Tables[0].Rows[i]["Distribution_Hsod_Name"].ToString();
side += "<br/>";
side += "HIT/Web Portal Administrator";
side += "</td><td align='right' style='padding-right: 10px;'>";
side += "<img id='signature' runat='server' alt='' style='width: 100px; height: 100px;'></img>";
//side += signature.Src = "data:image/png;base64,";
//side += base64String;
side += "<br /><label id='lblsignrank' runat='server'></label> ";
side += lblsignrank.InnerText = dt.Tables[0].Rows[i]["Rank"].ToString();
side += "<label id='lblsignname' runat='server'></label>";
side += lblsignname.InnerText = dt.Tables[0].Rows[i]["NameWORank"].ToString();
side += "<label id='lblDesignation' runat='server'></label><br/>";
side += lblDesignation.InnerText = dt.Tables[0].Rows[i]["RoleName"].ToString();
side += "</td></tr></table></td></tr><tr><td>Note:</td></tr><tr><td align='left'><ol type='1'><li>Either Leave/TyDuty can be taken separately or combined mentining both in same DTM.</li><li>Duties can be handed over to more than one officer on availability on following dates.In such case details to be mentined in tabular format.</li></ol></td></tr></table>";
int dtmid = Convert.ToInt32(dt.Tables[0].Rows[i]["DTM_HODTMID"]);
DataTable dtn = objTYMemoDTM.GetDTMMemoChildDetails(dtmid);
for (int j = 0; j < dtn.Rows.Count; j++)
{
htmlTable.Append("<table border='2' cellpadding=8 cellspacing=1>");
htmlTable.Append("<tr>");
//for (int k = 0; k < dtn.Columns.Count; k++)
//{
// htmlTable.Append("<th>" + dtn.Columns[k].ColumnName + "</th>");
//}
htmlTable.Append("<td>" + dtn.Rows[j]["FromDate"] + "</td>");
htmlTable.Append("<td>" + dtn.Rows[j]["FromSession"] + "</td>");
htmlTable.Append("<td>" + dtn.Rows[j]["ToDate"] + "</td>");
htmlTable.Append("<td>" + dtn.Rows[j]["ToSession"] + "</td>");
htmlTable.Append("<td>" + dtn.Rows[j]["DivisionName"] + "</td>");
htmlTable.Append("<td>" + dtn.Rows[j]["RoleName"] + "</td>");
htmlTable.Append("<td>" + dtn.Rows[j]["NameWORank"] + "</td>");
htmlTable.Append("</tr>");
}
htmlTable.Append("</table>");
/// lblSideMenu.InnerHtml = htmlTable.ToString();
}
htmlTablenew.Append("</tr>");
//GvOfficating.DataSource = dt.Tables[1];
//GvOfficating.DataBind();
}
htmlTablenew.Append("</table>");
htmlTablenew.Append(side);
lblSideMenu.InnerHtml = htmlTablenew.ToString() + htmlTable.ToString();
}