How to create Temporary Table in ASP.Net using C#
How to create Temporary Table in ASP.Net using C#:
In this post we create a table by programmatically by C#
code. Take grid control and bind dynamically created table in this gridviewcontrol.
Create Temporary Table by C#:
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="tablebyCsharp.aspx.cs"
Inherits="tablebyCsharp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/
DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>create Temporary Table in ASP.Net using C#</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<h1>
Temp data table in asp.net using c#</h1>
<br />
<%--bind this control by dymanic created table.--%>
<asp:GridView ID="gird1" runat="server"
>
<HeaderStyle BackColor="Maroon"
Font-Bold="true"
ForeColor="White"
/>
</asp:GridView>
</div>
</form>
</body>
</html>
Temporary Table in ASP.Net using C# code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class tablebyCsharp
: System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
createtable();
}
}
public void
createtable()
{
DataTable dt = new
DataTable();
dt.Columns.Add("Cost_Id", typeof(Int32));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Address", typeof(string));
dt.Rows.Add(1, "Parijat", "India");
dt.Rows.Add(2, "Roz", "U.S.A");
dt.Rows.Add(3, "Maqsood", "U.P.");
dt.Rows.Add(4, "Parvez", "Pakistan");
dt.Rows.Add(6, "Tinny", "Japan");
dt.Rows.Add(7, "Mr. Song", "Chine");
gird1.DataSource = dt;
gird1.DataBind();
}
}
Other asp.net related Post:
- Introduction of Asp.net grid view Control.
- Example of Templatefield in gridview.
- Example of DropDownList inside gridView
- Asp.net grid viewControl Programming.
- Checkbox within Asp.Net gridView.
- How to Bind gridview form database.
- Show gridview Row Details in Asp.net.
- Template field in gridview asp.net Example
- Example of Templatefield in asp.net gridview.
- Example of DropDownList inside GridView control
- How to use table for ListView layout in asp.net
- How to use table layout in ListView control in ASP.Net
- How to use Asp ListView control in asp.net
- ASP.NET ListView Demo Data and layout templates
- Ckeckbox list Example using javascript in gridview.
- Asp.net textbox control in inside of gridview
- How to Bind Gridview Form database.
- Show gridview Row Details And Give Example.
- Introduction of Asp.net grid view Control.
- Checkboxlist control in asp net
- Example of Adding ToolTip for each Dropdown List Item in C#
- Example of C# for Bind Data to asp.net Textbox inside gridview control
- Bind Data to asp.net textbox control in inside of gridview Using C# Example
- ListView.LayoutTemplate Property
- Displaying the textbox value in javascript Messagebox
- Get selected radio button values using JQuery.
- How do you do html text encodes using JavaScript
Comments
Post a Comment