Make a button field. On item command event of the datalist find this button.
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
Button ButtonHide = (Button)e.Item.FindControl("ButtonID");
}
if the button is inside a panel use;
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
Control panelControl = e.Item.FindControl("PanelID");
Button ButtonHide = panelControl.FindControl("ButtonID") as Button;
}
so on the click event of the button that you are using hide/unhide the panel;
maybe something like;
ClientScript.RegisterStartupScript(GetType(), "Javascript", "HidePanel()", true);
and your HidePanel() function;
function HidePanel()
{
var panel = document.getElementById('PanelID');
if(panel.style.display == 'none')
{
panel.style.display = 'block';
}
else
{
panel.style.display = 'none';
}
}