我的應用程序:如何使用jQuery的從該PopUpDialog,這個PopUpDialog控制在我ASP.NEt應用
我有兩個部分一個ASP.NET應用程序。第一部分是「缺席」部分,第二部分是「簽名」。此應用程序創建此部分自動。對於缺席,用戶必須輸入此缺席的結束日期和代表。該代表的TextBox具有從Active Directory獲取數據的自動完成功能。通過在文本框右側的圖像,用戶可以從jQuery的模式彈出窗口中搜索代表。 Popup有一個文本框和一個帶放大鏡符號的圖像按鈕。現在我想要的是,如果我點擊這個符號,我會在具有固定寬度和高度的PopUpBox中的ListView中找到所有找到的代表。
我的問題:
我彈出開放,我可以在這個PopUpDialog,這個PopUpDialog在div塊把我的控制。我爲我的ImageButton創建了一個事件併爲此生成了代碼,但是如果我點擊按鈕(在popupdialog中)代碼不起作用。它不會在Button_click法:(跳
我的問題:?
我怎麼能在我的PopUpDialog,這個PopUpDialog使用控件與jQuery和asp.net
這裏我的代碼:
ASPX:(jQuery代碼)
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#dialogbox").dialog({
autoOpen: false,
modal: true,
resizable: false,
buttons: {
"OK": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$("#imgVertreter").click(function() {
$("#dialogbox").dialog("open");
return false;
});
});
</script>
ASPX:(我popupdialogbox的div代碼)
<div id="dialogbox" title="Gesammte Vertreterliste">
<asp:TextBox ID="pVertreter" runat="server"></asp:TextBox>
<asp:ImageButton ID="pImageSearch" runat="server"
ImageUrl="~/App_Theme/lupe.jpg" Height="23px" Width="24px"
onclick="pImageSearch_Click" /><br />
<hr />
<asp:ListView runat="server" ID="ListView">
<LayoutTemplate>
<table id="UserTable" runat="server" border="0" width="100%" cellpadding="0" cellspacing="0">
<tr style="background-color:#ccdaeb" class="tableClass">
<th align="left" id="th4" runat="server"><asp:Label ID="lblName" runat="server" Text="Name, Vorname"></asp:Label></th>
<th align="left" id="th3" runat="server"><asp:Label ID="lblAbteilung" runat="server" Text="Abteilung"></asp:Label></th>
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td align="left"><asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="lblFullname" Text='<%# Eval("Name") %>' runat="server"></asp:LinkButton></td>
<td align="left"><asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="lblAbteil" Text='<%# Eval("Abteilung") %>' runat="server"></asp:LinkButton></td>
</tr>
</ItemTemplate>
<EmptyDataTemplate>
Es wurden keine Einträge gefunden
</EmptyDataTemplate>
<AlternatingItemTemplate>
<tr class="TableClass">
<td align="left"><asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="lblFullname" Text='<%# Eval("Name") %>' runat="server"></asp:LinkButton></td>
<td align="left"><asp:LinkButton CssClass="MyLink" CommandName="Select" CommandArgument='<%# Container.DataItemIndex %>' ID="lblAbteil" Text='<%# Eval("Abteilung") %>' runat="server"></asp:LinkButton></td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
</div>
爲的ImageButton(pImageSearch)我的C#代碼
protected void pImageSearch_Click(object sender, ImageClickEventArgs e)
{
try
{
UserService srv = new UserService();
DataTable dt = srv.BenutzerFinden(Domain, pVertreter.Text);
DataView dv = new DataView(dt);
dv.Sort = "Nachname ASC";
this.ListView.DataSource = dv;
this.ListView.DataBind();
}
catch (Exception)
{
}
}
這裏是我的應用程序圖片:
源代碼在IE中對我的TestApplication的作品!
<div id="dialog" title="Liste">
<input name="txtBox" type="text" value="rettet" id="txtBox" />
<input type="submit" name="btnEdit" value="übergeben" id="btnEdit" />
</div>
我的主要應用程序的源代碼不工作!
<div id="dialogbox" title="Vertreterliste">
<input name="pVertreter" type="text" id="pVertreter" />
<input type="image" name="pImageSearch" id="pImageSearch" src="App_Theme/lupe.jpg" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("pImageSearch", "", true, "", "", false, false))" style="height:23px;width:24px;" /><br />
<input type="submit" name="suchen" value="suchen" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("suchen", "", true, "", "", false, false))" id="suchen" />
</div>
爲什麼這裏是一個多點觸發Oo的onclick?
我的表單名稱id是form1是嗎? - > $(「#dialogbox」)。parent()。appendTo($(「form1#:first」)); – Tarasov
'form:first'應該足夠了。這樣你就不必擔心名字或班級。 Asp.net只有一種形式,其中包含所有控件。 – nunespascal
mhh但它不工作:(...我有我的div塊在窗體中的對話框,我使用$(「#dialogbox」)。父()。appendTo($(「表單#:第一」)) ); – Tarasov