private void BindData() { DataSet ds = new DataSet(); StringBuilder htmlTable = new StringBuilder(); ds = objb.getmedication_byprncode(Session["prn"].ToString(), TextBox21.Text); htmlTable.Append("<table style='width:100%' border=1px>"); htmlTable.Append("<tr ><th>NO.</th><th>NAME</th><th>DOSE</th><th>ROUTE</th><th>FREQUENCY</th><th>TIME</th></tr>"); if (!object.Equals(ds.Tables[0], null)) { if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { htmlTable.Append("<tr>"); htmlTable.Append("<td align='center'>" + i + 1 + "</td>"); htmlTable.Append("<td align='center'>" + ds.Tables[0].Rows[i]["category"] + "." + ds.Tables[0].Rows[i]["drug"] + "</td>"); htmlTable.Append("<td align='center'>" + ds.Tables[0].Rows[i]["dose"] + "</td>"); htmlTable.Append("<td align='center'>" + ds.Tables[0].Rows[i]["route"] + "</td>"); htmlTable.Append("<td align='center'>" + ds.Tables[0].Rows[i]["frequency"] + "</td>"); htmlTable.Append("<td align='center'>" + ds.Tables[0].Rows[i]["timea"] + "------" + ds.Tables[0].Rows[i]["timeb"] + "------" + ds.Tables[0].Rows[i]["timec"] + "------- " + ds.Tables[0].Rows[i]["timed"] + " </td>"); htmlTable.Append("</tr>"); } htmlTable.Append("</table>"); } else { htmlTable.Append("<tr>"); htmlTable.Append("<td align='center' colspan='4'>There is no Record.</td>"); htmlTable.Append("</tr>"); } } }