User475983607 posted
Let's start with the basics. What is the error? Is it an exception or is the code not working as expected?
A quick glance at the posted code shows that the link button is never hidden. It is always set to true. Use the Visual Studio debugger to verify your syntax.
if (username67 == Session["userName"].ToString())
{
(Datalist1.Row.FindControl("btnEdit") as LinkButton).Visible = true;
}
else
{
(Datalist1.Row.FindControl("btnEdit") as LinkButton).Visible = true;
}
See the Visual Studio debugger docs at the following link.
https://msdn.microsoft.com/en-us/library/y740d9d3.aspx