0

我有一个 ASP.NET 应用程序,用于ListView在“BenutzerListe.aspx”中列出所有搜索用户。客户端用户可以选择一个用户并在一个名为“benutzer.aspx”的额外 Web 表单中显示该用户的属性。在“Benutzer.aspx”中,用户可以更改这些属性。

我想显示这些信息,而不是在第二个 Web 窗体中,而是在由 jQuery 创建的对话框中。我听说我可以在对话框中输入我的“Benutzer.aspx”。

我怎么能做到这一点?

我的想法:

带有想法模型的屏幕截图

aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="~/BenutzerListe.aspx.cs" Inherits="BenutzerListe.BenutzerListe" %>

<!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 runat="server">
    <title></title>

    <script src="Scripte/jquery-1.7.2.js" type="text/javascript"></script>

     <link href="~/App_Theme/BenutzerListeStyle.css" type="text/css" rel="Stylesheet" />

    <style type="text/css">
        #SuchTabelle
        {
            width: 587px;
        }
    </style>

    <script type="text/javascript">

        $(document).ready(function () {

            $("#Button2").click(function (event) {

                //How I open a Dialog with Benutzer.aspx

            });

    </script>

</head>
<body>
    <form id="form1" runat="server">

    <div class="header">
        <table id="SuchTabelle" runat="server" border="0">

            <tr>
                <th><asp:Label ID="id_SearchUser" runat="server" Text="lblSearchUser"></asp:Label></th>
                <th><asp:TextBox ID="txtBenutzer" runat="server" Width="250px"></asp:TextBox></th>

            </tr>
            <tr>
                <th><asp:Label ID="id_location" runat="server" Text="lblLocation"></asp:Label></th>
                <th><asp:DropDownList ID="dropWerk" runat="server" Width="250px" /></th>
                <th><asp:Button ID="Button2" runat="server" Text="Suchen" 
                                onclick="btnBenutzerSuchen_Click" Width="219px" /></th>
            </tr>

        </table>

        <div id="bild">
            <asp:Image runat="server" ImageUrl="~/App_Theme/lw_logo.jpg" Height="58px" 
                Width="277px" />
        </div>

        <div id="meldung">
            <asp:Label runat="server" ID="lblMeldung"></asp:Label>
        </div>

      </div>

      <div class="bodyList">


        <asp:ListView runat="server" ID="myListView">

        <LayoutTemplate>
            <table id="UserTable" runat="server" border="0" width="800" cellpadding="0" cellspacing="0">
                <tr style="background-color:#E5E5FE" class="TableClass">
                    <th id="th1" runat="server"><asp:LinkButton ID="lnkBenutzer" runat="server" >id_Benutzer</asp:LinkButton></th>
                    <th id="th2" runat="server"><asp:LinkButton ID="lnkemail" runat="server" >id_Email</asp:LinkButton></th>
                    <th id="th3" runat="server"><asp:LinkButton ID="lnkVorname" runat="server" >id_Vorname</asp:LinkButton></th>
                    <th id="th4" runat="server"><asp:LinkButton ID="lnkNachname" runat="server" >id_Nachname</asp:LinkButton></th>
                    <th id="th5" runat="server"><asp:LinkButton ID="lnkTelefon" runat="server" >id_Telefon</asp:LinkButton></th>
                </tr>
                <tr runat="server" id="ItemPlaceholder">
                </tr>
            </table>
        </LayoutTemplate>

        <ItemTemplate>

            <tr class="TableClass">    
                <td align="left" ><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label1" Text='<%# Eval("Benutzername") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label2" Text='<%# Eval("eMail") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label3" Text='<%# Eval("Vorname") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label4" Text='<%# Eval("Nachname") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label5" Text='<%# Eval("Telefonnummer") %>' runat="server" /></td>

              <td align="left"><asp:Label ID="Label6" Text='<%# Eval("GUID") %>' runat="server" Visible="False" /></td>

            </tr>

        </ItemTemplate>

        <AlternatingItemTemplate>

            <tr class="TableClass"> 

                <td align="left" ><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label1" Text='<%# Eval("Benutzername") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label2" Text='<%# Eval("eMail") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label3" Text='<%# Eval("Vorname") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label4" Text='<%# Eval("Nachname") %>' runat="server" /></td>
                <td align="left"><asp:LinkButton CssClass="MyLink" OnCommand="Button1_Command" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="Label5" Text='<%# Eval("Telefonnummer") %>' runat="server" /></td>

                <td align="left"><asp:Label ID="Label6" Text='<%# Eval("GUID") %>' runat="server" Visible="False" /></td>

            </tr>

        </AlternatingItemTemplate>

        </asp:ListView>

        <br />
        <br />

    </div>

    </form>
</body>
</html>
4

2 回答 2

0

试试这是否有帮助:

http://msdn.microsoft.com/en-us/library/ie/ms536759(v=vs.85).aspx

于 2012-08-08T12:36:30.043 回答
0

您可以使用JQUERY UI 对话框做一些简单的事情:

在您的页面中:

<div id="dialog">
<iframe src="Benutzer.aspx"></iframe>
</div>

在您的 jquery 函数中:

 $(document).ready(function () {

            $("#Button2").click(function (event) {

               $( "#dialog" ).dialog();

            });
于 2012-08-08T13:02:29.840 回答