I have a string storing some data i want to display that data on
a aspx page how should i do it??

I have a string storing some data i want to display that data on
a aspx page how should i do it??

I didnt get exactly what you are asking, but if you have a data stored in a string variable its so simple to display it in an aspx webpage:
Add a label control to your page, and name it for example Label1 then add the following code to your page_load event as bellow:

using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


public partial class InsertRecord : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strVar = "Hello World";
Label1.Text = strVar.ToString();
Response.Write(strVar.ToString());
}
}

Regards,
Khaled

Edited 3 Years Ago by happygeek: fixed formatting

Thanx for reply and this do work but my problem is that i retrieved some data from a excel sheet using oledb commands but and stored it in a string but the data in excel sheet has text that is bold,italics have super-script involved but when i display it on web/win form that bold,italics.....etc features vanishes and i dont know how to deal with this problem any ideas???

Thanx for reply and this do work but my problem is that i retrieved some data from a excel sheet using oledb commands but and stored it in a string but the data in excel sheet has text that is bold,italics have super-script involved but when i display it on web/win form that bold,italics.....etc features vanishes and i dont know how to deal with this problem any ideas???

for formatting you should use HTML tags, like if you want to display a text as a bold add the bold tag to the string:

string strVar = "<b>Hello World</b>";
Label1.Text = strVar.ToString();
Response.Write(strVar.ToString());


Regards,
Khaled

This article has been dead for over six months. Start a new discussion instead.