本文介绍了Jquery Dialog未在第二次单击时打开。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的asps页面代码请仔细检查代码并告诉我为什么链接不能在第二次工作。



Here is My asps page code Plese Review the code and tell me why the link is not working on second time.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Example.aspx.cs" Inherits="Example" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head  runat="server">
    <link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui.css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"

    rel="stylesheet" type="text/css" />
<style>
    .btn_styling {
        text-align: center;
        width: 32px;
        margin: 2px;
        cursor: pointer;
        border: 1px solid gray;
        border-radius: 3px; 

       /* add a background image to the div 
          to make the div look like a button */ 
       /* background-image: url('...')  */
    }
    .ui-dialog-titlebar-close {
        display: none;
    }
</style>
    <title></title>
<script type="text/javascript">
    var dialogOptions = {
       autoOpen: false,
        appendTo: "#dialogContainer",
        modal: true,
        height: "auto",
        width: "auto",
        title: "Dialog Title",
        closeOnEscape: true,
        show: { effect: "fold", duration: 4000 },
        buttons: {
            Cancel: function () {
                $(this).remove();
            }

        }

    };
    $(".ui-widget-overlay").live("click", function () {
        $("div:ui-dialog:visible").dialog("close");
    });  
  
    $(document).on("click", ".dialog-marker", function () {
      
            var d = $(this).next("div").first().dialog(dialogOptions);
            d.dialog("open");
    });
</script>

</head>
<body>
    <form id="form1"  runat="server">
  <div style="width: 400px;">
    <asp:GridView ID="GridView1" OnRowDataBound="GridView1_RowDataBound" runat="server" AutoGenerateColumns="False"

      DataKeyNames="BusNo"

      DataSourceID="SqlDataSource1">
      <columns>
        <asp:BoundField DataField="RouteName" HeaderText="RouteName" SortExpression="RouteName" />
        <asp:TemplateField HeaderText="Info">
          <itemtemplate>
            <div id="divButton"  runat="server"  class="btn_styling dialog-marker" title="This could also have been a <button> element or maybe an <img> element...anything really">X</itemtemplate></columns></div>
            <div id="popup" style="display: none;">
              <asp:GridView ID="GridView2" runat="server"

                AutoGenerateColumns="False"

                DataSourceID="SqlDataSource2">
                <columns>
                  <asp:BoundField DataField="StopName" HeaderText="StopName" SortExpression="StopName" />
                  
                </columns>
              
              <asp:SqlDataSource ID="SqlDataSource2" runat="server" 

                ConnectionString="<%$ ConnectionStrings:constr %>"

                SelectCommand="SELECT StopName from BusStops WHERE (BusNo = @BusNo)">
                <SelectParameters>
                  <asp:Parameter Name="BusNo" />
                </SelectParameters>
              
            </div>
          
        
      
      <rowstyle bordercolor="Blue" borderstyle="Solid" borderwidth="1px" />
    
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 

      ConnectionString="<%$ ConnectionStrings:constr %>"

      SelectCommand="SELECT BusNo,RouteName from BusRoutes">
    
  
  <div id="dialogContainer">
  </div>
</form>
</body>
</html>

推荐答案




这篇关于Jquery Dialog未在第二次单击时打开。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 10:36