Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a small application of asp.net.

In this application I use only html control not standard control of asp.net. By using html control I am able to insert data in to database but how do I display data in html table from database in my application?

Please if you have any idea about it then give me.

Thanks
Posted
Updated 25-Oct-10 21:42pm
v2
Comments
Dalek Dave 26-Oct-10 3:42am    
Edited for Grammar and Syntax.

ASP.NET Datagrid equivalent in HTML is a Table.

If you do a viewsource of any ASP.NET page with Datagrid in it, you will see that the grid is rendered as a Table with rows and columns.

If you do not want to use datagrid (ASP.NET control) then you need to add table with data on the page at runtime. You can design the table if you know the structure (which is generally not the case.)
 
Share this answer
 
Comments
deepak chaudhari snk 26-Oct-10 2:13am    
i want to use table as a grid view, how i can use it because i don't know size of table therefore i want to create table at run time if you have idea about it then please reply.
Thanks for reply.
Sandeep Mewara 26-Oct-10 2:43am    
You need to loop through the records and create rows and add data. Once table is complete , add that to the UI panel/placeholder.
XML
HTML CODE
------------------
<table id="TBL" runat="server" style="width: 100%; border-collapse: collapse;" >
<tr>
<th>S No.</th>
<th>Name</th>
</tr>
</table>


Server Side Code
-----------------------
using System.Web.UI.HtmlControls;
<br />
HtmlTableRow Trow = new HtmlTableRow();
HtmlTableCell Tcell1 = new HtmlTableCell();
HtmlTableCell Tcell2 = new HtmlTableCell();
Tcell1.InnerHtml = "1";
Tcell2.InnerHtml ="Vindhya";
TBL.Rows.Add(Trow);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900