-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event_History.aspx.cs
72 lines (68 loc) · 2.52 KB
/
Event_History.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Data;
using System.Data.SqlClient;
using System.IO;
namespace cseclubs
{
public partial class Event_History : System.Web.UI.Page
{
private SqlConnection con = new SqlConnection("Data Source=KIRAN\\SQLEXPRESS;Initial Catalog=mydatabase;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindrows();
// BindRow();
}
}
public void bindrows()
{
using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["con"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("SELECT [Club_Name] FROM [Clubs];"))
{
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
clubsearch.DataTextField = ds.Tables[0].Columns["Club_Name"].ToString();
clubsearch.DataSource = ds.Tables[0];
clubsearch.DataBind();
conn.Close();
}
}
clubsearch.Items.Insert(0, new ListItem("Select Club NAME", "0"));
}
protected void clubsearch_SelectedIndexChanged(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("Select * from dbo.Event_Audit Where Club_Name='" + clubsearch.SelectedValue + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
int count = ds.Tables[0].Rows.Count;
con.Close();
if (ds.Tables[0].Rows.Count > 0)
{
gridView.DataSource = ds;
gridView.DataBind();
}
else
{
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
gridView.DataSource = ds;
gridView.DataBind();
int columncount = gridView.Rows[0].Cells.Count;
lblmsg.Text = " No data found !!!";
}
}
}
}