How to Make Data Table By C# code in Asp.net Programming:
How to Make Data Table By C# code in Asp.net Programming:
In asp.net Programming, it is very easy that we can create a
data table by code and use it as like table.As we know that Table has row and Columns, the sequence is
table has number of rows and then Rows has number of columns,In HTML Language we create Table as like This :
<Table>//Table Open
//First Row
In Table .
<tr>//Row Open.
//First
Column in Row ----------------------------1
<td>// Column Open.
</td>// Column Close.
//Second
Column In Row…………………………………2
<td>// Column Open.
</td>// Column Close.
</tr>//Row Close.
</Table> //
Table Close.
Similarly we can add more than one row and more than one
column in a table.
Now we are going to
make a Table (dataTable) in asp.net by C# code .As we know the C# provide many
library for coding .
Make The object of Data table Class which is present System.data package.
DataTable dt=new DataTable();
DataTable dt = new DataTable();
//Create Columns……………with
data type ……………………..
DataColumn
RegID = new DataColumn("RegID",typeof(Int32));
DataColumn
Marks= new DataColumn("Marks", typeof(Double));
//Add Column into Table …………………………………………
dt.Columns.Add(RegID);
dt.Columns.Add(Marks);
//Make the Object of Row………………………………………………………
DataRow dtRow = dt.NewRow();
//Fill value in to Row ‘s
Column……………………………………………………..
dtRow["RegID"]=1;
dtRow["Marks"]
= 75;
//Add Row in to Table ………………………………………………
dt.Rows.Add(dtRow);
now you have to datatable and then you do fill many controls of asp.net
as like GridView,Chrats,Lists ETC....
RegID
|
Marks
|
1
|
75
|
Other Asp.net Related Examples Post:
- Example-of-crystal-report
- How-to-bind-grid-view-in-asp.net
- what-is-asp.net-framework-part-1
- What-is-asp.net-programming-part-2.
- Chat-web-application-in-asp.net.
- Sql-helper-class
- Fill data into Dropdown list by using Jquery
- Validate ASP.Net RadioButtonList using JavaScript Example
- Example of jQuery Validate on Radiobuttonlist in Asp.Net using C#
- Example jQuery Validate on CheckBoxList using C#
- Check Uncheck all asp.net CheckBox in asp.net using jQuery
- Check Uncheck all html CheckBox controls using jQuery:
- Asp.net CheckBoxList using jQuery.
- Cropping image using jQuery in asp.net
- Displaying the textbox value in javascript Messagebox
- Get selected radio button values using JQuery.
- How do you do html text encodes using JavaScript
- Limit Number of Characters in a TextArea using jQuery
- Limitation of Characters in Textbox or TextArea in asp.netusing jquery:
- jquery disable or Enable submit button after validation
- Enable Disable Submit Button using jQuery
- JQuery UI Datepicker (Calendar) with asp.net textbox
- Get current datetime in jquery and javaScript
- How to create master page in asp net c#
- Asp.net page Directives
- Create ASPX Page in ASP.Net and C#
- Create a website in ASP.Net with C#
- Cookies,how to make Cookies in asp.net with C#.
- ASP .NET Read a text file by C#
- Adding Dynamic Rows in ASP.Net GridView Control with Textbox
- Create Dynamic Rows in ASP.Net GridView Control with TextBoxes