Пример #1
0
    private void BindData()
    {
        ds = objb.getmedication_byopdcode(Session["opd_code"].ToString());

        htmlTable.Append("<table style='width:100%'>");
        htmlTable.Append("<tr ><th>category</th><th>drug</th><th>dose</th><th>route</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>" + ds.Tables[0].Rows[i]["category"] + "</td>");
                    htmlTable.Append("<td>" + ds.Tables[0].Rows[i]["drug"] + "</td>");
                    htmlTable.Append("<td>" + ds.Tables[0].Rows[i]["dose"] + "</td>");
                    htmlTable.Append("<td>" + ds.Tables[0].Rows[i]["route"] + "</td>");
                    htmlTable.Append("<td>" + 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>");
                PlaceHolder1.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>");
            }
        }
    }