TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Harsha Eadara
NA
45
8.4k
Fetching data from DB if i click on TAB .
Jul 14 2017 1:12 AM
Hi i'm doing a project in asp.net .I have to create a tab and by clicking that tab i have to fetch data from DB.I'm Able to create a TAB.But I'm not able to fetch data from DB if i click on TAB.I'm posting my code ,if there is any modifications pls help me out.
This is my WebForm1.aspx.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Link1.WebForm1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="~/Content/jquery-ui.css" rel="stylesheet" />
<script src="~/Scripts/jquery-ui-1.12.1.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"></asp:GridView>
<br />
</div>
<asp:TabContainer ID="Admin" runat="server" ActiveTabIndex="0" ><asp:TabPanel runat="server" HeaderText="Admin" ID="TabPanel">
</asp:TabPanel></asp:TabContainer>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
</form>
</body>
</html>
This is my WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data.MySqlClient;
namespace Link1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataBind();
}
protected void Button_click(object sender, EventArgs e)
{
MySqlConnection con = new MySqlConnection("server=localhost;user id=root;database=perfautomationdb;password=Password@1");
con.Open();
MySqlCommand cmd = new MySqlCommand("SELECT * FROM tfsperfqueue", con);
MySqlDataAdapter adp = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
cmd.ExecuteNonQuery();
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
}
Reply
Answers (
2
)
How to design a form compatible to Mobile and Tablet in MVC?
getting error "The underlying connection was closed "