Hi micah,
Now i can say you are not understanding the code you are just copy pasting code. Because we have already provided you same type of sample twice. Below are the links.
You are using FormView and in the code you are using DataList Event i.e. DataListItemEventArgs
There is no event OnItemDataBound for FormView that takes DataListItemEventArgs as one parameter. In FormView there is OnDataBound event and it takes parameter as EventArgs.
So your code should be
protected void Post_DataBound(object sender, EventArgs e)
{
Image imageA = Post.FindControl("imguserImage") as Image;
Panel pnlA = Post.FindControl("pnlhidusers3") as Panel;
Panel pnlB = Post.FindControl("pnlresimagesmall") as Panel;
if (!string.IsNullOrEmpty(imageA.ImageUrl))
{
pnlA.Visible = true;
pnlB.Visible = false;
}
else
{
pnlA.Visible = false;
pnlB.Visible = true;
}
}
And the FormView should be
<asp:FormView ID="Post" runat="server" CssClass=" " OnDataBound="Post_DataBound">
So change the above and use find control with proper id to find the controls and change the condition if it is wrong.