通过链接按钮弹出JQuery对话框
我有一个链接按钮.点击那个链接按钮,我想弹出一个对话框.我试了很多,但无法继续.
以下是关于我如何尝试这一点的代码片段.
在.cs文件中:(这是我动态创建链接按钮的方式)(我在jQuery中使用了lnkButton类.
选择 | 换行 | 行号
- LinkButton lnkUpdateComment = new LinkButton();
- lnkUpdateComment.ID = "" + objBridgeNotes.BridgeNotesId;
- lnkUpdateComment.Text = "edit";
- lnkUpdateComment.Attributes.Add("class", "lnkButtons");
- lnkUpdateComment.Click += new EventHandler(lnkUpdateComment_Click);
.js文件:
选择 | 换行 | 行号
- $(document).ready(function() {
- $(".lnkButtons").live("click", function() {
- $("#divEditComment").dialog("option", "title", "Edit the Comment");
- $("#divEditComment").dialog("open");
- return true;
- });
- $(function () {
- var dlg = $("#divEditComment").dialog({
- autoOpen: false,
- show: "blind",
- hide: "blind",
- //height: 450,
- minWidth: 400,
- //position: ['right', 210],
- buttons: {
- "Update Note": function () {
- var Updates = btnSubmitComment.replace(/_/g, '$');
- __doPostBack(Updates, '');
- }
- }
- });
- dlg.parent().appendTo(jQuery("form:first"));
- });
- });
在.aspx文件中:
选择 | 换行 | 行号
- <div id="divEditComment">
- <asp:UpdatePanel ID="updComments" runat="server">
- <ContentTemplate>
- <div>
- <table width="100%" style="text-align: center">
- <tr>
- <td>
- <div id="divComments" runat="server">
- </div>
- </td>
- </tr>
- </table>
- </div>
- </ContentTemplate>
- </asp:UpdatePanel>