protected void Page_Load(object sender, EventArgs e) { DataAccessLayer dao = new DataAccessLayer(); if (!String.IsNullOrEmpty(Request.QueryString["agentID"])) { param = Convert.ToInt32(Request.QueryString["agentID"]); SqlDataReader reader; reader = dao.SelectUserByID(param); while (reader.Read()) { agentName.InnerText = reader.GetString(2).ToString(); agentDesc.InnerText = reader.GetString(9).ToString(); agentEmail.InnerText = reader.GetString(5).ToString(); agentPhone.InnerText = reader.GetString(3).ToString(); agentSkype.InnerText = reader.GetString(11).ToString(); string profPic = reader.GetString(12); propUserName.Value = agentEmail.InnerText.ToString(); agentProfile.ImageUrl = "userassets/" + reader.GetString(5) + "/" + profPic; SqlDataReader reader2 = dao.GetUserPropertiesbyAgentID(param, Constants.isApproved); Repeater1.DataSource = reader2; Repeater1.DataBind(); } } else { Response.Redirect("Error-404.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { DataAccessLayer dao = new DataAccessLayer(); try { if (!String.IsNullOrEmpty(Request.QueryString["id"])) { // Query string value is there so now use it param = Convert.ToInt32(Request.QueryString["id"]); } SqlDataReader reader = dao.SelectUserByID(param); while (reader.Read()) { // userID = reader.GetInt32(0); // userType = reader.GetByte(1); // userName = reader.GetString(2); // userMobile = reader.GetString(3); // userPassword = reader.GetString(4); // userEmail = reader.GetString(5); // userFb = reader.GetString(6); // userLinkedin = reader.GetString(7); // userTwitter = reader.GetString(8); // userDescription = reader.GetString(9); // userSkype = reader.GetString(11); // userImage = reader.Getint32(12); int id = reader.GetInt32(0); string name = reader.GetString(2); string phone = reader.GetString(3); string email = reader.GetString(5); string userFb = reader.GetString(6); string userLinkedin = reader.GetString(7); string userTwitter = reader.GetString(8); string userDescription = reader.GetString(9); string userSkype = reader.GetString(11); string userImage = reader.GetString(12); if (!IsPostBack) { txtName.Text = name; txtPhone.Text = phone; txtEmail.Text = email; txtFB.Text = userFb; txtLinkedin.Text = userLinkedin; txtTwitter.Text = userTwitter; txtDescription.InnerText = userDescription; txtSkype.Text = userSkype; userPicture.Attributes["src"] = @"userassets\" + email + @"\" + userImage; } } } catch (System.NullReferenceException r) { //exception handling } }