How to retrieve data like a Blog Post in ASP.net?
-
Hello Friends! I am working on my College Major Project. My project contains a part, where the Admin will post News (using Editor like a Blog). This News is then stored in Database. Now I want to retrieve "top 2" news and post them on Home page. I am retirieving data and displaying it all in a Label Control on Home page. I want to provide the following Format to the News : ========================== Title With Hyperlink ------------------------------ News News News.... .... ... ..... News. ========================= I am using the following Code to retrieve the data, but I am not able the get the above mentioned layout. foreach (DataRow dr in DS.Tables[0].Rows) { for (int j = 0 ; j < 2 ; j++) { lblNews.Text = "<b> <font size=4>" + lblNews.Text + " " + Convert.ToString(dr[j]) + "</font></b>"; } } Is there any other way to access all the Retrieved data?
-
Answer:
you are retrieving correctly but the formatting should not be done that way. The solution is rather than writing blNews.Text = "<b> <font size=4>" + lblNews.Text + " like this use the formatting style of bold and fontsize =4 in .aspx file So for the label in aspx page write like this <asp:lable font-size="4" font-bold="true" ... REMEMBER if you want hyperlink you have to use <asp:hyperlink /> tag rather than label.
Dhaval Malte at Yahoo! Answers Visit the source
Related Q & A:
- How to retrieve data from table using its key?Best solution by msdn.microsoft.com
- How to scrape data from a website?Best solution by Stack Overflow
- How do you start up a blog?Best solution by Yahoo! Answers
- How do I Comment on a Blog?Best solution by Yahoo! Answers
- How do I know if my blog post is completely private?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.