using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DAL; using BLL; using System.Data; using System.Data.SqlClient; using System.Configuration; namespace XcellIT { public partial class WebForm4 : System.Web.UI.Page { //SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString); private string CS = ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString; private BusinessLogicLayer bll = null; USER user = null; CLUB club = null; protected void Page_Load(object sender, EventArgs e) { if (IsPostBack != true) { bll = new BusinessLogicLayer(); ddlAthleteName.Items.Add(new ListItem("Select Athlete", "")); ddlAthleteName.AppendDataBoundItems = true; try { ddlAthleteName.DataSource = bll.FillAthlete(); ddlAthleteName.DataTextField = "Name"; ddlAthleteName.DataValueField = "UserID"; ddlAthleteName.DataBind(); } catch(Exception ex) { throw ex; } } else { } } protected void ddlAthleteName_SelectedIndexChanged(object sender, EventArgs e) { string strQuery = "SELECT * FROM USER WHERE UserID = @UserID"; SqlConnection con = new SqlConnection(CS); SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@UserID", ddlAthleteName.SelectedItem.Value); cmd.CommandType = CommandType.Text; cmd.CommandText = strQuery; cmd.Connection = con; try { con.Open(); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { txtGender.Text = sdr["Gender"].ToString(); txtEmail.Text = sdr["EmailAddress"].ToString(); txtPhoneNumber.Text = sdr["PhoneNumber"].ToString(); txtCity.Text = sdr["City"].ToString(); } } catch (Exception ex) { throw ex; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)