This is code when i create my sample web application i want to create html ui in back end code so i created using string builder.
if (dt.Rows.Count > 0) { StringBuilder strb = new StringBuilder(); strb.Append("<br/><br/>"); strb.Append("<table border='1' cellpadding='3'>"); for (int i = 0; i < dt.Rows.Count; i++) { strb.Append("<tr><td>"); strb.Append(dt.Rows[i]["Subject"].ToString()); strb.Append("</td>"); strb.Append("<td>"); strb.Append("<input type=\"text\" name=\"subject\" id=\"txtSubject" + i.ToString() + "\" runat=\"server\" />"); strb.Append("<input type=\"hidden\" name=\"hidsubject\" id=\"hidSubject" + i.ToString() + "\" runat=\"server+\" value=" + dt.Rows[i]["Subject_ID"].ToString() + "/>"); strb.Append("</td></tr>"); } //subject = subject + "," + dt.Rows[i]["Subject_ID"].ToString(); //hidSubject.Value = subject; strb.Append("</table>"); divMark.InnerHtml = strb.ToString(); }
0 comments
Post a Comment