Database Records display like list<li>

Hello Experts

I am trying to create a Latest News section on homepage. Refer attachment for screenshot.

the latest news details are coded like this

      <li class="last">wordpress</li>

now i cant understand how can i get it populated with database records. i know how to get the record set from the database but i am unable to get the User interface exactly like the screenshot.

I dont mind if i have to use datagrid, gridview, tables or anything but i need get the same look.

how can i achieve the desired result. Appreciate you help
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You use a ListView Control  with DataPage or DataList Control
ListView sample:,339028371,339287696,00.htm
Sometimes if I have an html layout that is working for me and I want to model it from a datasource such as SQL I will emit exactly the HTML I want from the code behind like this:

See EX:

Of course you'd have to add attributes like "class" and more elements like youre paging and title, but if you already have that working in HTML it's pretty cool to re-create it from code behind using data from SQL.
    <div id="parentDiv" runat="server"></div>

    protected void Page_Load(object sender, EventArgs e)
        SqlConnection conn = new SqlConnection(string.Format(@"Data Source=.\SQLEXPRESS;Integrated Security=True"));
        SqlCommand cmd = new SqlCommand("SELECT fName FROM DevTable",conn);

        HtmlGenericControl ul = new HtmlGenericControl("ul");

        SqlDataReader dr = cmd.ExecuteReader();

            HtmlGenericControl li = new HtmlGenericControl("li");
            li.InnerHtml = dr["fName"].ToString();


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AsishRajAuthor Commented:
thanks experts,

let me evaluate both the options and i will get back with the results.

Saqib KhanSenior DeveloperCommented:
you can also simply create a Literal Control and keep appending text to it and then assign its text value to Page's Div.

However I loved ddayx10's Solution. Neat & Clean.
AsishRajAuthor Commented:
Both the method works as i requested.

Thanks a lot for your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.