Pages

Thursday, August 23, 2012

Code to deselect all the items of the Listbox

<asp:ListBox ID="lbTopics" runat="server" Width="200px" SelectionMode="Multiple" onclick="javascript:listselection();" CssClass="normalFields"></asp:ListBox>

function listselection()
{
    var listitem=document.getElementById("<%=lbTopics.ClientID %>");
    if(listitem.options[0].selected)
    {
        listitem.selectedIndex = -1;
    }
}

No comments:

Post a Comment