You are on page 1of 3

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.

cs"
Inherits="_Default" Debug="false" %>

<!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 runat="server">
<title>Untitled Page</title>
<style type="text/css">
#form1
{
font-weight: 700;
font-size: xx-large;
height: 46px;
width: 732px;
margin-left: 40px;
}
.style1
{
font-size: large;
height: 35px;
color: #FFFFFF;
}
</style>
</head>
<body background="loginbg2.jpg">
<form id="form1" runat="server">
<span lang="en-us" style="color:
#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DISPLAY OF DETAILS...</span><p>
&nbsp;</p>
<p class="style1">
Enter your Class Name(Table name) to display the Project details...&nbsp;
<asp:TextBox ID="TextBox1" runat="server" Height="39px"
ontextchanged="TextBox1_TextChanged" Width="195px"
BackColor="Transparent"
style="color: #FFFFFF"></asp:TextBox>
</p>
<p class="style1">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</p>
<p class="style1">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" Height="43px"
onclick="Button1_Click"
Text="Submit" Width="141px" BackColor="Transparent"
style="font-weight: 700; color: #FFFFFF; font-size: xx-large; font-
family: 'Segoe Print'" />
&nbsp;</p>
<p class="style1">
<asp:GridView ID="GridView1" runat="server" Height="315px" Width="520px"
BackColor="Black" style="color: #FFFFFF">
</asp:GridView>
</p>
</form>
</body>
</html>

cs file

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data.SqlTypes;

public partial class _Default : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
string str = @"Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\USERS\SHRUT\DOCUMENTS\VISUAL STUDIO
2008\WEBSITES\DISCONNECT\APP_DATA\DATABASE.MDF;Initial
Catalog=C:\USERS\SHRUT\DOCUMENTS\VISUAL STUDIO
2008\WEBSITES\DISCONNECT\APP_DATA\DATABASE.MDF;Integrated Security=true;Connect
Timeout=30;User Instance=True";
SqlConnection conn = new SqlConnection(str);
SqlCommand cmd= new SqlCommand("Select * from " + TextBox1.Text, conn);
SqlDataAdapter sda=new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds, TextBox1.Text);
GridView1.DataSource = ds;
GridView1.DataBind();
}

You might also like