Click here to Skip to main content
15,908,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to show/hide a panel inside datalist control using javascript when a button inside this datalist clicked.but i just can't find out how to do that!.i used google but no solution till now.please give solution...
Posted

you can used the overlib library for this purpose.
 
Share this answer
 
Comments
mridul samadder 12-May-11 14:57pm    
what is that and how to use?? give me links
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';
    }
}  
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900