Click here to Skip to main content
15,893,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the code Like

XML
<script type="text/javascript">
        function saveCoOrdinate() {
            var offsetPanel = $("[id$=imgCertificate]").offset();
            var len = $(".dragMe").length;
            for (var i = 1; i <= len; i++) {
                var cont = $('.dragMe span:contains("' + i + '")').text();
                var offsetText = $('.dragMe:contains("' + cont + '") textarea').offset();
                var offsetTop = offsetText.top - offsetPanel.top;
                var offsetLeft = offsetText.left - offsetPanel.left;
                $("[id$=ddlBoxName]").append($("<option>" + cont + "</option>"));
                $("[id$=ddlXCoOrdinates]").append($("<option>" + offsetTop + "</option>"));
                $("[id$=ddlYCoOrdinates]").append($("<option>" + offsetLeft + "</option>"));
            }
            //document.getElementById("[id$=btnSaveValues]").click();
        }
    </script>


and drop down list


XML
<asp:DropDownList ID="ddlBoxName" runat="server">
                </asp:DropDownList>
                <asp:DropDownList ID="ddlXCoOrdinates" runat="server">
                </asp:DropDownList>
                <asp:DropDownList ID="ddlYCoOrdinates" runat="server">
                </asp:DropDownList>

and the button


<asp:Button ID="btnSaveValues" runat="server" Text="Save" OnClientClick="saveCoOrdinate(); return false;"
UseSubmitBehavior="false" OnClick="btnSaveValues_Click" />
the onclick event is not working
Posted
Updated 1-Aug-14 1:18am
v3

You are returning false in onClientClick event, hence the server click event won't fire. Remove it and execute.
 
Share this answer
 
v2
 
Share this answer
 
use html dropdownlist.Then click will work
 
Share this answer
 

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