开发者

jquery return value

开发者 https://www.devze.com 2023-02-13 08:52 出处:网络
I used the following to popup a modal with grid and then returning the selected values back to parent. This worked fine in a standalone project with just one aspx page.

I used the following to popup a modal with grid and then returning the selected values back to parent. This worked fine in a standalone project with just one aspx page.

<script>

    function openDialog() {

        $("#MyModal").dialog('open');
    }

    function CloseDialog() {
        $("#MyModal").dialog('close');

        $("input#txtName").val($("input#hdnName").val());
        $("input#txtFName").val($("input#hdnFName").val());
        $("input#txtLName").val($("input#hdnLName").val());

    }

    $(document).ready(function() {

        $("#MyModal").dialog({ autoOpen: false });



        //event can fire on the click of HTML Table 
        $("#<%=grdModal.UniqueID%> tr").click(function() {
            var id = $(this).find("td:nth-child(1)").html();
            var Name = $(this).find("td:nth-child(2)").html();
            var fName = $(this).find("td:nth-ch开发者_开发问答ild(3)").html();
            var lName = $(this).find("td:nth-child(4)").html();

            $("input#hdnId").val(id);
            $("input#hdnName").val(Name);
            $("input#hdnFName").val(fName);
            $("input#hdnLName").val(lName);
        });

        // Change the Mouse Pointer on grid row hover

        $('#<%=grdModal.ClientID%> tr').mouseover(function() {
            $(this).css({ cursor: "hand", cursor: "pointer" });
        });                    

</script>

I filled the gridview with a dummy datatable in codebehind. now when i put this into my solution it doesn't return values back to parent.!!? any clue y?? i have pasted this same code in solution.


You should try and debug the JS to get a better idea what is happening.

Does alert($("input#hdnPrincipalName").val()); produce anything?

Also what does the actual rendered HTML look like? Make sure the ID's did not get changed when the page is actually rendered.

0

精彩评论

暂无评论...
验证码 换一张
取 消