Click here to Skip to main content
13,000,742 members (45,934 online)
Rate this:
Please Sign up or sign in to vote.
See more:

a button inside aspx page as below,

   <asp:ImageButton ID="removeButton" runat="server"  OnClick="removeStudentInformation" OnClientClick="return checkBoxselectedornot()" ImageUrl="~/image/remove-selected-button.png" /> 

But it's onclientclick doesn't work in to solve?

javascript as below

function checkBoxselectedornot() {
        var valid = false;
        var gridview = document.getElementById("studentInformationGrid");
        for (var i = 0; i < gridview.all.length; i++) {
            var node = gridview.all[i];
            if (node != null && node.type == "checkbox" && node.checked) {
                valid = true;
        if (!valid) {
            alert("Invalid. Please select a student to continue.");
        return valid;


Posted 21-Dec-12 19:39pm
Updated 23-Dec-12 17:38pm
AshishChaudha 22-Dec-12 3:40am
Share the code block of Javascript please
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

hasbina 22-Dec-12 7:12am
where write the below code?

removeButton.OnClientClick = String.Format("ElementStyle(document.getElementById('wrapper'),'display','none'); {0}; return false;", Page.ClientScript.GetPostBackEventReference(removeButton, ""));

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100