-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbloodtype.aspx.cs
67 lines (58 loc) · 2.26 KB
/
bloodtype.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
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 System.Data.SqlClient;
using System.Configuration;
public partial class bloodtype : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["BloodBank"].ToString());
SqlCommand cmd = new SqlCommand("select * from Address", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
drpGovernorate.DataSource = dt;
drpGovernorate.DataBind();
}
}
protected void Button2_Click1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["BloodBank"].ToString());
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "selectBloodType";
SqlParameter p1 = new SqlParameter("@Blood_Id", drpBloodType.SelectedValue);
SqlParameter p2 = new SqlParameter("@governrate", drpGovernorate.SelectedValue);
SqlParameter p3 = new SqlParameter("@City_Name", drpCity.SelectedValue);
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
cmd.Parameters.Add(p3);
cmd.Connection = con;
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
//adapt.SelectCommand = cmd;
//adapt.Fill(ds);
con.Close();
}
protected void drpGovernorate_SelectedIndexChanged(object sender, EventArgs e)
{
drpCity.Items.Clear();
drpCity.Items.Add("--اختر المركز--");
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["BloodBank"].ToString());
SqlCommand cmd = new SqlCommand("select * from City where Address_id=" + drpGovernorate.SelectedItem.Value, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
drpCity.DataSource = dt;
drpCity.DataBind();
}
}