private void bindcomplain() { DataSet ds = new DataSet(); StringBuilder htmlTable = new StringBuilder(); ds = objb.get_complain_byopdcode(Session["opd_code"].ToString()); htmlTable.Append("<table style='width:100%' border=1px>"); htmlTable.Append("<tr ><th>Complain</th><th>Remark</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'>" + ds.Tables[0].Rows[i]["complain"] + "</td>"); htmlTable.Append("<td align='center'>" + ds.Tables[0].Rows[i]["remark"] + "</td>"); htmlTable.Append("</tr>"); } htmlTable.Append("</table>"); PlaceHolder0.Controls.Add(new Literal { Text = htmlTable.ToString() }); } else { htmlTable.Append("<tr>"); htmlTable.Append("<td align='center' colspan='4'>There is no Record.</td>"); htmlTable.Append("</tr>"); } } }