Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Have .js file with following code. It is for load dialog box from Grid view select button.I need to fire jquery function from code behind ( Select button click event )Pls advice.

JavaScript


C#
$(function () {

   

    $("#LocalDialogModal").dialog('destroy');

    $("#LocalDialogModal").dialog({
        dialogClass: 'DynamicDialogStyle',
        autoOpen: false,
        resizable: false,
        draggable: false,
        modal: true,

        open: function (type, data) {
            $(this).parent().appendTo("form");
        },

        width: 890,
        height: 358,

        title: "Please select the hardware item "
    });

    $("#txtresult").text("Sum of all the contents is: ");

    $("#LoadLocalDialog").off("click");
    var url = "DialogContentPage.aspx";
    $("#txtresult").text("url");

    $(document).on("click", "#LoadLocalDialog", function () {
        //debugger;

        $("#LocalDialogModal").dialog("open");
    });




});    //end of main jQuery R



I tried the below code

but it is not working. pls help

ClientScript.RegisterStartupScript(this.GetType(), "LoadLocalDialog", "dialog();", true);
Posted
Comments
Dominic Burford 21-May-15 1:39am    
I'm not entirely sure you understand the mechanics of JQuery or client-side scripting. Jquery is a javascript client-side library which means it is executed and runs on the client in the browser. Therefore you need to include your script code either on the ASP page or via a URL. You then need to associate your script with an event on your control so it gets fired. I would spend some time looking through examples of how to use client-side scripting and JQuery first to make sure you fully understand it.
aliabdulkp 21-May-15 1:59am    
OK , Now i included in page. Kindly advice how to fire LoadlocalDialog1 from code behind.

Thank you for the valuable information
Kindly advice how can i include this query in asp page.
 
Share this answer
 
Comments
Deepu S Nair 21-May-15 1:56am    
Don't post your comment as solution.If you want to respond to the comment use the "Reply" link next to it. This will notify the commenter.
aliabdulkp 21-May-15 2:12am    
Noted ..
OK , Now i included in page. Kindly advice how to fire LoadlocalDialog1 from code behind.




XML
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RequestStatus.aspx.cs" MaintainScrollPositionOnPostback="true" Inherits="SIGED_SRM.RequestStatus" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

    <script type="text/javascript" src="Script/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="Script/jquery-ui-1.8.17.custom.min.js"></script>
<%--    <script type="text/javascript" src="Script/DemoScript.js"></script>
--%>    <link href="Style/jquery-ui-1.8.17.custom.css" rel="Stylesheet" type="text/css" />

<%--    <script src="Script/DemoScript.js" type="text/javascript"></script>
--%>




    <title></title>

        <script type="text/javascript">

            function myFunction() {
                //some code here

                alert('Function called successfully!');




                //---------------------------------------------



                $("#LocalDialogModal").dialog('destroy');

                $("#LocalDialogModal").dialog({
                    dialogClass: 'DynamicDialogStyle',
                    autoOpen: false,
                    resizable: false,
                    draggable: false,
                    modal: true,

                    open: function (type, data) {
                        $(this).parent().appendTo("form");
                    },

                    width: 890,
                    height: 358,
                    title: "Please select  "
                });


//                $("#LoadLocalDialog").off("click");
                $(document).on("click", "#LoadLocalDialog1", function () {
                    //debugger;

                    $("#LocalDialogModal").dialog("open");
                });



            }
         </script>
 
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