String Builder Class in asp.net

Posted by Indranil Mutsuddy on Stack Overflow See other posts from Stack Overflow or by Indranil Mutsuddy
Published on 2010-04-28T10:01:23Z Indexed on 2010/04/28 10:03 UTC
Read the original article Hit count: 471

Filed under:
|

Hiya,

Suppose I want to display text retrieved from data base and I want to display the text applying color, font style etc.

Is that possible?..Below is a sample code which i 've done recently. SqlDataReader myreader; myreader = cmmd.ExecuteReader();

                        StringBuilder sb = new StringBuilder();
                        sb.Append("<b>Vaccine</b>&nbsp;&nbsp;&nbsp;<b> Vaccination Date</b>&nbsp;&nbsp;&nbsp;<b> Vaccination Due Date</b>&nbsp;&nbsp;&nbsp;<b> Incomplete Vaccination </b>&nbsp;&nbsp;&nbsp;<b>Dose No.</b>&nbsp;&nbsp;&nbsp;<b> Remarks </b><br/><br/>");
                        while (myreader.Read())
                            {
                                    sb.Append(myreader["VaccineID"]);
                                    sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                    sb.Append(myreader["DateOFVaccine"]);
                                    sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                    sb.Append(myreader["NextVaccinationDueDate"]);
                                    sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                    sb.Append(myreader["AnyIncompleteImmunization"]);
                                    sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                    sb.Append(myreader["DoseNumber"]);
                                    sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                                    sb.Append(myreader["Remark1"]);
                                    sb.Append("<br/>");
                            }
                        lblDisplayDetails.Text = sb.ToString();
                        myreader.Close();

Thank You

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#