You can assign the href attribute dynamically. Something like below.
if (e.Row.RowType == DataControlRowType.DataRow)
{
HtmlAnchor hreft = (HtmlAnchor)e.Row.FindControl("btnedit");
if(IsUserLogin)
{
hreft.HRef = assign URL
}
else
{
hreft.HRef = "javascript:void(0);";
}
}
Hope it helps.