protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["UserLogin"] != null) { DataSet ds = GetDetails(); RepeaterDetails.DataSource = ds; RepeaterDetails.DataBind(); ds = GetSkills(); RepeaterSkills.DataSource = ds; RepeaterSkills.DataBind(); ds = GetRequests(); RepeaterRequested.DataSource = ds; RepeaterRequested.DataBind(); ds = GetApplier(); RepeaterRequesters.DataSource = ds; RepeaterRequesters.DataBind(); } else { Response.Redirect("Login.aspx"); } } }
protected void btnSearch_Click(object sender, EventArgs e) { cmd = new SqlCommand("RoomSearch", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@roomNo", roomNo.Value)); DataSet ds = new DataSet(); da = new SqlDataAdapter(cmd); da.Fill(ds); RepeaterDetails.DataSource = ds; setRepeaterDetails(ds.Tables[0].Rows.Count); RepeaterDetails.DataBind(); }
public void loadData() { con.Open(); cmd = new SqlCommand("RoomList", con); cmd.CommandType = CommandType.StoredProcedure; DataSet ds = new DataSet(); da = new SqlDataAdapter(cmd); da.Fill(ds); RepeaterDetails.DataSource = ds; setRepeaterDetails(ds.Tables[0].Rows.Count); RepeaterDetails.DataBind(); }
public void RepeaterData() { String strConnString = ConfigurationManager.ConnectionStrings["JPSContext"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConnString)) { conn.Open(); cmd = new SqlCommand("Select * from Customers", conn); DataSet ds = new DataSet(); da = new SqlDataAdapter(cmd); da.Fill(ds); RepeaterDetails.DataSource = ds; RepeaterDetails.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { this.UnobtrusiveValidationMode = 0; Services service = new Services(); string lat = Session["Lat"].ToString(); string lng = Session["Long"].ToString(); hiddenfieldUserLat.Value = lat; hiddenfieldUserLong.Value = lng; hiddenfieldServiceLat.Value = service.getlatitude(Convert.ToInt32(Session["id"])).ToString(); hiddenfieldServiceLong.Value = service.getlongitude(Convert.ToInt32(Session["id"])).ToString(); RepeaterDetails.DataSource = service.getName(Convert.ToInt32(Session["id"])); RepeaterDetails.DataBind(); RepeaterImage.DataSource = service.getImages(Convert.ToInt32(Session["id"])); RepeaterImage.DataBind(); Repeater1.DataSource = service.getComments(Convert.ToInt32(Session["id"])); Repeater1.DataBind(); }
protected void RepeaterProfile(object source, RepeaterCommandEventArgs e) { //byte[] bytes = (byte[])GetData("SELECT ProfilePicture FROM tblUsers WHERE Id =" + Convert.ToInt32(Session["UserId"])).Rows[0]["ProfilePicture"]; //string base64String = Convert.ToBase64String(bytes, 0, bytes.Length); //((Image)e.Item.FindControl("imgProfile")).ImageUrl = "data:image/png;base64," + base64String; if (e.CommandName == "Edit") { if (((Label)e.Item.FindControl("lblGender")).Text == "Male") { ((RadioButton)e.Item.FindControl("RadioButtonMale")).Visible = true; ((RadioButton)e.Item.FindControl("RadioButtonFemale")).Visible = true; ((RadioButton)e.Item.FindControl("RadioButtonMale")).Enabled = true; ((RadioButton)e.Item.FindControl("RadioButtonFemale")).Enabled = true; ((RadioButton)e.Item.FindControl("RadioButtonMale")).Checked = true; } else { ((RadioButton)e.Item.FindControl("RadioButtonMale")).Visible = true; ((RadioButton)e.Item.FindControl("RadioButtonFemale")).Visible = true; ((RadioButton)e.Item.FindControl("RadioButtonMale")).Enabled = true; ((RadioButton)e.Item.FindControl("RadioButtonFemale")).Enabled = true; ((RadioButton)e.Item.FindControl("RadioButtonFemale")).Checked = true; } ((Label)e.Item.FindControl("lblName")).Visible = false; ((Label)e.Item.FindControl("lblEmail")).Visible = false; ((Label)e.Item.FindControl("lblGender")).Visible = false; ((Label)e.Item.FindControl("lblCity")).Visible = false; ((Label)e.Item.FindControl("lblPhone")).Visible = false; ((Label)e.Item.FindControl("lblDob")).Visible = true; ((TextBox)e.Item.FindControl("tbxName")).Visible = true; ((TextBox)e.Item.FindControl("tbxEmail")).Visible = true; ((TextBox)e.Item.FindControl("tbxCity")).Visible = true; ((TextBox)e.Item.FindControl("tbxPhone")).Visible = true; ((Label)e.Item.FindControl("tbxDob")).Visible = false; if (((Label)e.Item.FindControl("lblDob")).Text.Length > 10) { ((Label)e.Item.FindControl("tbxDob")).Text = ((Label)e.Item.FindControl("tbxDob")).Text.Remove(10); ((Label)e.Item.FindControl("lblDob")).Text = ((Label)e.Item.FindControl("tbxDob")).Text; } ((Button)e.Item.FindControl("btnEdit")).Visible = false; ((Button)e.Item.FindControl("btnUpdate")).Visible = true; } else if (e.CommandName == "Update") { //bytes = (byte[])GetData("SELECT ProfilePicture FROM tblUsers WHERE Id =" + Convert.ToInt32(Session["UserId"])).Rows[0]["ProfilePicture"]; //base64String = Convert.ToBase64String(bytes, 0, bytes.Length); //((Image)e.Item.FindControl("imgProfile")).ImageUrl = "data:image/png;base64," + base64String; string Gender = ""; if (((RadioButton)e.Item.FindControl("RadioButtonMale")).Checked == true) { Gender = "Male"; } else { Gender = "Female"; } SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["UserDetailsConnectionString"].ConnectionString); string getFields = "update tblUsers set Name=@Name,Email=@Email,Gender=@Gender,City=@City,Phone=@Phone where Id='" + Convert.ToInt32(Session["UserId"]) + "'"; SqlCommand cmd = new SqlCommand(getFields, connect); connect.Open(); cmd.Parameters.AddWithValue("@Name", ((TextBox)e.Item.FindControl("tbxName")).Text); cmd.Parameters.AddWithValue("@Email", ((TextBox)e.Item.FindControl("tbxEmail")).Text); cmd.Parameters.AddWithValue("@Gender", Gender); cmd.Parameters.AddWithValue("@City", ((TextBox)e.Item.FindControl("tbxCity")).Text); cmd.Parameters.AddWithValue("@Phone", ((TextBox)e.Item.FindControl("tbxPhone")).Text); cmd.ExecuteNonQuery(); connect.Close(); ((Label)e.Item.FindControl("lblName")).Visible = true; ((Label)e.Item.FindControl("lblEmail")).Visible = true; ((Label)e.Item.FindControl("lblGender")).Visible = true; ((Label)e.Item.FindControl("lblCity")).Visible = true; ((Label)e.Item.FindControl("lblPhone")).Visible = true; ((Label)e.Item.FindControl("lblDob")).Visible = true; ((TextBox)e.Item.FindControl("tbxName")).Visible = false; ((TextBox)e.Item.FindControl("tbxEmail")).Visible = false; ((RadioButton)e.Item.FindControl("RadioButtonMale")).Visible = false; ((RadioButton)e.Item.FindControl("RadioButtonFemale")).Visible = false; ((TextBox)e.Item.FindControl("tbxCity")).Visible = false; ((TextBox)e.Item.FindControl("tbxPhone")).Visible = false; ((Label)e.Item.FindControl("tbxDob")).Visible = false; ((Button)e.Item.FindControl("btnEdit")).Visible = true; ((Button)e.Item.FindControl("btnUpdate")).Visible = false; DataSet ds = GetDetails(); RepeaterDetails.DataSource = ds; RepeaterDetails.DataBind(); } }