I want to make button Add not visible when the authenticated user is on the profile page then make the button Edit visible for the authenticated User.
protected void FormView1follow_ItemDataBound(object sender, DataListItemEventArgs e)
{
using (SqlConnection con = new SqlConnection(constring))
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM User3 where UserName='" + Request.QueryString["Id"].ToString() + "' AND UserName='" + Session["userName"] + "' ", con))
{
con.Open();
//cmd.Parameters.AddWithValue("@UserName", Request.QueryString["Id"].ToString());
SqlDataReader idr = cmd.ExecuteReader();
if (idr.Read())
{
(e.Item.FindControl("btnEdit") as LinkButton).Visible = true;
}
else
{
(e.Item.FindControl("btnAdd") as LinkButton).Visible = true;
}
}
}
}