bind database inside html table

Posted by Oswaldlily under ASP.NET on 8/11/2011 | Points: 10 | Views : 2556 | Status : [Member] | Replies : 2
I need to bind table inside normal html table....

is it possible in design or need to switch on codebehind??
whatever possible,can u suggest me some code?


Posted by: Jpchoudhari on: 8/12/2011 [Member] Starter | Points: 25

can you clarify your question, you want to display table inside table????
what data you want to display and how??? can't you do that with grid??

Kind Regards,

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Itorian on: 8/15/2011 [Member] Starter | Points: 25

it is not important to switch code-behind always to bind the data. there are ton of datacontrols that will do automatically it for you say as gridvidw. But remember, if u need to develop any strong or say extra formatted apps, you need to switch in code-behind. In visual studio, switch the web form in design view and from database explorer drag the database table on form (remember web form should be in design view). even it will generate the connection string in web.cofig file automatically. this process will automatically bind the data as well. Find the sample code here:

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" AllowPaging="True"
DataSourceID="EmployeesSqlSource" DataKeyNames="EmployeeID"
<asp:BoundField DataField="EmployeeID"
HeaderText="EmployeeID" InsertVisible="False"
ReadOnly="True" SortExpression="EmployeeID" />
<asp:BoundField DataField="LastName"
HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="FirstName"
HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="Title"
HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="BirthDate"
HeaderText="BirthDate" SortExpression="BirthDate" />
<asp:BoundField DataField="PostalCode"
HeaderText="PostalCode" SortExpression="PostalCode" />
<asp:BoundField DataField="Extension"
HeaderText="Extension" SortExpression="Extension" />
<div style="text-align: center">
No Data Available.
<asp:SqlDataSource ID="EmployeesSqlSource" runat="server"
"Data Source=MELIGY\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
"SELECT [EmployeeID], [LastName], [FirstName], [Title], [BirthDate], [PostalCode], [Extension] FROM [Employees]"

Student of M.Tech IT | Microsoft MVP | Mindcracker MVP | IT Faculty | Blogger | Author

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response