I have a panel control in gridview's template.
I need to hide/unhide panel in javascript function, for that i need to pass panel's id to the javascript.
The problem is that all panels have the same id in gridview, so I need to set unique id to each panel.
I tried to do:
<asp:Panel id= "Panel_<%# Eval("ID")%>"
and some other variations but always get an error.
The panel contains some other controls, I need it to be server side because I need to set at code-behind (after checking if user is authenticated)
What can I do?
p.s.
It doesn't have to be Panel, any other control that I can find with Findcontrol and can hold other controls.
Update:
I set the the js event in code behind:
protected void gvw_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (UserIsAuthenticated)
{
HyperLink title = e.Row.FindControl("lnkTitle") as HyperLink;
Panel panel = e.Row.FindControl("panel") as Panel;
title.Attributes.Add("onmouseover", "ShowHidePanel(" + panel.ClientID +")");
//All get the same id!!!
}
}
}