I m creating a web page in which i want to put some content . I want that content should come from database with in proper order means with html tags . please suggest me proper eg
there's no need for a text file in this scenario. You can store your content in your database, make a call to the appropriate column in your code and then put/append the result at the place where you need it.
Regards.
If my post solves your problem, please mark as answer.
lucky1527
Member
93 Points
88 Posts
text file
Mar 02, 2012 08:50 AM|LINK
How to use text file in asp.net
I m creating a web page in which i want to put some content . I want that content should come from database with in proper order means with html tags . please suggest me proper eg
TUFAN01MAN
Participant
1208 Points
301 Posts
Re: text file
Mar 02, 2012 09:17 AM|LINK
use a dataset to get the records and use a label control.
Horizon_Net
Star
8277 Points
1435 Posts
Re: text file
Mar 02, 2012 09:22 AM|LINK
Hi,
there's no need for a text file in this scenario. You can store your content in your database, make a call to the appropriate column in your code and then put/append the result at the place where you need it.
If my post solves your problem, please mark as answer.
Sum8
Contributor
4141 Points
931 Posts
Re: text file
Mar 02, 2012 09:25 AM|LINK
Hi,
Refer this link to read a TXT file: http://www.codeproject.com/Articles/251/Reading-a-text-file-in-ASP
And to show the data on page use Response.Write
For Ex.
string strText = "<table><tr><td height=100 bgcolor=#555555>Sample Text.....</td></tr></table>"; // Data fetched from TXT file
Response.Write(strText );
Sumit Pathak
------------------
ThisPost = Helped == True ? "Mark As Answer" : "Elaborate your problem in more details"
lucky1527
Member
93 Points
88 Posts
Re: text file
Mar 02, 2012 09:39 AM|LINK
how about using textarea html button by using it through database did u have eg of it.
Sum8
Contributor
4141 Points
931 Posts
Re: text file
Mar 02, 2012 09:51 AM|LINK
Try this:
string strText = "<table><tr><td height=100 bgcolor=#555555><textarea id='textarea1' class='mycss' rows='10' cols='50'>Sample Text....</textarea></td></tr></table>"; // Data fetched from TXT file Response.Write(strText);Sumit Pathak
------------------
ThisPost = Helped == True ? "Mark As Answer" : "Elaborate your problem in more details"
lucky1527
Member
93 Points
88 Posts
Re: text file
Mar 02, 2012 10:42 AM|LINK
i have got the answer we can use text file in asp.net by below method
public void readthis()
{
string inputString;
using (StreamReader streamReader = File.OpenText(Server.MapPath("~") + @"\"+nn+".txt"))
{
inputString = streamReader.ReadLine();
while (inputString != null)
{
LableDesc.Text += inputString +
"<br \\>";
inputString = streamReader.ReadLine();
}
}
}