Hi.......
I have a web page. there are four tables links. Like as...
Table1 Table 2 Table 3 Table 4
........................................................
I want, when we click on Table 1 then table 1 will be open below the Table 1 link and when we click on Table 2 then table2 will be open below the Table 2 link and so on.....
Please tell me anyone with example ?
Thanks.............
Loading

Vineet Kumar SainiPosted Feb 26, 2012, 4:09 AM
Your answer is good but I want to do same work in HTML. How to do this work in HTML ? Please tell me ....?
Thanks..........
Satyapriya NayakPosted Feb 26, 2012, 3:07 AM
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Link_table._Default" %>
using System;
using System.Collections;
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;
namespace Link_table
{
public partial class _Default : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
protected void LinkButton1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from employee";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "employee");
GridView1.DataMember = "employee";
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from student";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "student");
GridView2.DataMember = "student";
GridView2.DataSource = ds;
GridView2.DataBind();
con.Close();
}
protected void LinkButton3_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from product";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "product");
GridView3.DataMember = "product";
GridView3.DataSource = ds;
GridView3.DataBind();
con.Close();
}
}
}
Thanks
If this post helps you mark it as answer