Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/437.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么我的jQuery模式弹出窗口不显示?_C#_Javascript_Jquery_Asp.net_Jquery Ui Dialog - Fatal编程技术网

C# 为什么我的jQuery模式弹出窗口不显示?

C# 为什么我的jQuery模式弹出窗口不显示?,c#,javascript,jquery,asp.net,jquery-ui-dialog,C#,Javascript,Jquery,Asp.net,Jquery Ui Dialog,我使用的是asp:Panel而不是div标记,不确定它在asp:DataGrid中是否重要,这样我就可以创建模式弹出窗口,链接到页面加载时绑定到DataGrid的特定数据 JavaScript/jQuery: function ShowCommentPanel(caller) { $("div[id*='pnlComment'][GroupCoveragePeriodId='" + $(caller).attr("GroupCoveragePeriodId") + "']").dialo

我使用的是asp:Panel而不是div标记,不确定它在asp:DataGrid中是否重要,这样我就可以创建模式弹出窗口,链接到页面加载时绑定到DataGrid的特定数据

JavaScript/jQuery:

function ShowCommentPanel(caller) {
    $("div[id*='pnlComment'][GroupCoveragePeriodId='" + $(caller).attr("GroupCoveragePeriodId") + "']").dialog({
        width: 350,
        height: 200
    });
}
ASP.NET标记:

<asp:TemplateColumn HeaderText="Comment">
     <HeaderStyle HorizontalAlign="Center" Width="90px" CssClass="ColorBackground SubHeaderText" />
     <ItemStyle HorizontalAlign="Center" Width="90px" CssClass="DataGridBorder Font11px" />
     <ItemTemplate>
          <div>
               <asp:HyperLink ID="lnkComment" runat="server" CssClass="IconEdit" ToolTip="Add/Edit" />
          </div>
          <asp:Panel ID="pnlComment" runat="server" title="Comment" style="display: none;">
                <asp:TextBox ID="txtComment" runat="server" TextMode="MultiLine" Width="300px" Height="100px" />
          </asp:Panel>
     </ItemTemplate>
</asp:TemplateColumn>
Firebug生成的HTML代码屏幕截图:


应用程序代码编译良好,页面加载良好,我的JavaScript/jQuery函数被成功调用,我的jQuery选择器不是空的,但是它仍然没有显示模式。我不知道为什么没有情态动词出现,所以任何能为我指明正确方向的建议都将不胜感激。提前感谢。

您的选择器正在查找带有GroupCoveragePeriodId的div标记,因为当该属性实际位于a标记上时,我看不到任何空格

尝试在div和[id..之间使用空格:

function ShowCommentPanel(caller) {
    $("div [id*='pnlComment'][GroupCoveragePeriodId='" + $(caller).attr("GroupCoveragePeriodId") + "']").dialog({
        width: 350,
        height: 200
    });
}

注意:要知道您的选择器是否得到了一些信息,请检查长度是否大于0:alert$div[id*='pnlcommont'][GroupCoveragePeriodID='1'.length

这太愚蠢了。我不知道在我的ascx控件中调试这个问题时是否使用了太多Ctrl+Zing,但在查看Firefox控制台之后,显然我收到了一个错误,说这个。dialog不是一个函数。我发誓我添加了对jquery-ui.js文件的引用,但我必须删除它在过多的Ctrl+Zing之后,我就可以打开它了。现在我可以弹出模态了。很抱歉浪费了大家的时间。

注意:我正在做的这个项目使用的是过时的jQuery版本,尽管我怀疑这是问题所在。它使用的jQuery版本是v1.3.2,对话框功能是由jQuery UI v1.7.2提供的。很抱歉,屏幕截图是专业版的bably看起来很困惑,因为我恰好高亮显示了顶部的div。面板是div下面的淡出div,其中有一个标记。屏幕截图中底部淡出div也有一个GroupCoveragePeriodId属性,所以我想我的选择器应该能找到它。
function ShowCommentPanel(caller) {
    $("div [id*='pnlComment'][GroupCoveragePeriodId='" + $(caller).attr("GroupCoveragePeriodId") + "']").dialog({
        width: 350,
        height: 200
    });
}