I have a profile page were i display all users
profile images with either button add or button
edit. So the idea is when for example if i login
i will see all the profile photos of all users
including my own photo but the only button that will
show beside my photo is edit button, the button add
will be hidden, every other photo of users on the
page will only have button add while edit button will
be hidden
see code for showing all users
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.Populatebooks();
}
}
private void Populatebooks()
{
// string userId = Session["userName"].ToString();
// string userId = Session["userName"].ToString();
// string str = ConfigurationManager.ConnectionStrings["DMGS"].ConnectionString;
string Populatebooks = "GetUserPOSTS";
using (SqlConnection con = new SqlConnection(constring4))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(Populatebooks, con))
{
cmd.CommandType = CommandType.StoredProcedure;
// cmd.Parameters.AddWithValue("@Name", Request.QueryString["Id"].ToString());
cmd.Parameters.AddWithValue("@UserName", Session["userName"]);
// cmd.Parameters.AddWithValue("@Id", Id);
//lblpost.Text = TextBixcomment.Text.Replace(Environment.NewLine, "<BR />");
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
ViewState["DataTable"] = dt;
GetMergedAll.DataSource = dt;
GetMergedAll.DataBind();
}
}
}