gpt4 book ai didi

jquery - 单击 gridview 内的链接按钮时无法触发 jquery 警报

转载 作者:行者123 更新时间:2023-12-01 06:20:26 24 4
gpt4 key购买 nike

当用户尝试删除Gridview中的记录时,我写了一个确认,如下

<head runat="server">
<title></title>
<style type="text/css">
BODY, HTML
{
padding: 0px;
margin: 0px;
}
BODY
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
background: #FFF;
padding: 15px;
}

H1
{
font-size: 20px;
font-weight: normal;
}

H2
{
font-size: 16px;
font-weight: normal;
}

FIELDSET
{
border: solid 1px #CCC;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
padding: 1em 2em;
margin: 1em 0em;
}

LEGEND
{
color: #666;
font-size: 16px;
padding: 0em .5em;
}

PRE
{
font-family: "Courier New" , monospace;
font-size: 11px;
color: #666;
background: #F8F8F8;
padding: 1em;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
}

/* Custom dialog styles */
#popup_container.style_1
{
font-family: Georgia, serif;
color: #A4C6E2;
background: #005294;
border-color: #113F66;
}

#popup_container.style_1 #popup_title
{
color: #FFF;
font-weight: normal;
text-align: left;
background: #76A5CC;
border: solid 1px #005294;
padding-left: 1em;
}

#popup_container.style_1 #popup_content
{
background: none;
}

#popup_container.style_1 #popup_message
{
padding-left: 0em;
}

#popup_container.style_1 INPUT[type='button']
{
border: outset 2px #76A5CC;
color: #A4C6E2;
background: #3778AE;
}
</style>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.ui.draggable.js" type="text/javascript"></script>
<!-- Core files -->
<script src="jquery.alerts.js" type="text/javascript"></script>
<link href="jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function () {
var id = $("<%# GridView1.ClientID %> tr").find('#btnDelete.ClientID');
$("#btn").click(function () {
jConfirm('Are you sure you want to delete?', 'Confirmation Dialog', function (r) {
if (r == true) {
__doPostBack(id, "");
}
else
return false;
});
});
});
</script>
</head>

我的GridView如下

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting" Width="574px">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="Id" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="eid" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="Name" runat="server" Text='<%#Eval("Name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="ename" runat="server" Text='<%#Eval("Name") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemTemplate>
<asp:Label ID="Address" runat="server" Text='<%#Eval("Address") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="eprice" runat="server" Text='<%#Eval("Address") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="edit" runat="server" Text="Edit" CommandName="edit"></asp:LinkButton>
<input id="btn" type="button" value="Delete" class="submit_12" />
<asp:LinkButton ID="btnDelete" runat="server" Visible="false" Text="Delete" CommandName="Delete" />
</ItemTemplate> <EditItemTemplate>
<asp:LinkButton ID="update" runat="server" Text="Update" CommandName="update"></asp:LinkButton>
<asp:LinkButton ID="cancel" runat="server" Text="Cancel" CommandName="cancel"></asp:LinkButton>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

但是我无法获得所需的警报,谁能告诉我哪里出了问题

enter image description here

我正在使用来自此网站的警报

http://labs.abeautifulsite.net/archived/jquery-alerts/demo/

添加了所有必需的脚本,但问题仍然相同

添加脚本

enter image description here

最佳答案

您的页面中可能没有注册 JQuery。

看一下: http://docs.jquery.com/How_jQuery_Works#jQuery:_The_Basics

了解如何在页面上包含 JQquery。

关于jquery - 单击 gridview 内的链接按钮时无法触发 jquery 警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9666927/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com