我在 ASP.Net 中使用 GridView 并添加 jQuery 对话框以在编辑按钮上显示数据,当我单击 Dailog 的保存按钮时,它加载对话框并显示数据,我无法在 ASP.Net (C#) 代码后面获取值。
<script type="text/javascript">
$(function () {
$("#Phone-Modal").dialog({
autoOpen: false,
height: 400,
width: 430,
modal: false,
open: function (type, data) {
$("#Phone-Modal").parent().appendTo($("form"));
}
});
});
function showDialog(id) {
$('#' + id).dialog("open");
}
</script>
<div id="Phone-Modal" class="p10" title="Phone Verifications">
<div class="left wfull">
<asp:Label runat="server" ID="Label1"></asp:Label></div>
<div class="left clear" style="height: 248px">
<div class="left">
<asp:HiddenField ID="HdfMemberID" runat="server" Value="" />
Profile : <span style="margin-left: 65px; font-weight: bold">
<asp:Label runat="server" ID="lblProfile"></asp:Label></span>
</div>
<div class="left clear wfull mt10 mb10">
Phone Number : <span style="font-weight: bold">
<asp:Label runat="server" ID="lblPhone"></asp:Label></span>
</div>
<div class="left wfull mt10 mb10">
<div style="width: 110px; padding-right: 20px;">
Admin Notes:</div>
<asp:TextBox ID="ReplyTextBox1" TextMode="MultiLine" runat="server" Rows="10" Columns="25"
MaxLength="2000" ValidationGroup="sendEmail" Style="background-color: White;
width: 100px !important;">
</asp:TextBox>
<ajaxtoolkit:HtmlEditorExtender ID="HtmlEditorExtender1" TargetControlID="ReplyTextBox1"
runat="server">
<Toolbar>
<ajaxtoolkit:Undo />
<%--<ajaxtoolkit:Redo />
<ajaxtoolkit:Bold />
<ajaxtoolkit:Italic />
<ajaxtoolkit:Underline />
<ajaxtoolkit:InsertOrderedList />
<ajaxtoolkit:Indent />
<ajaxtoolkit:Outdent />
<ajaxtoolkit:BackgroundColorSelector />
<ajaxtoolkit:ForeColorSelector />--%>
</Toolbar>
</ajaxtoolkit:HtmlEditorExtender>
</div>
<br />
<div class="left clear mt140">
Pass Code:
<asp:TextBox runat="server" ID="txtPassCode1" name="txtPassCode1" TextMode="Password"
Style="margin-left: 43px;">
</asp:TextBox>
<asp:HiddenField ID="hdfmid" runat="server" Value='<%# Eval("Member_ID")%>' />
</div>
</div>
<div class="left wfull " style="margin-top: 25px">
<div class="left mt15">
<label>
Verify Phone:
</label>
</div>
<div class="left mt10">
<asp:DropDownList ID="ddlPhoneStatus" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPhoneStatus_SelectedIndexChanged"
CssClass="dropdown_effect ml30" Width="175px">
<asp:ListItem Text="Select Status" Value="0">
</asp:ListItem>
<asp:ListItem Text="Verified" Value="1">
</asp:ListItem>
<asp:ListItem Text="Not Verified" Value="2">
</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
<asp:GridView ID="GridView1" runat="server" CssClass="mb20" AutoGenerateColumns="False"
AllowPaging="true" PageSize="25" HeaderStyle-CssClass="grdHeader" CellPadding="5"
OnPageIndexChanging="GridView1_PageIndexChanging1" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Profile" HeaderStyle-HorizontalAlign="Left">
<ItemStyle Width="130px" HorizontalAlign="center" />
<ItemTemplate>
<asp:HyperLink runat="server" ID="hl" NavigateUrl='<%# string.Format("~/test.aspx?id={0}","id"))) %>'
Target="_blank"><%# Eval("Alias") %></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Phone1">
<ItemStyle Width="130px" HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblPhone1" runat="server" Text='<%# Eval("Value 1")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Phone Type">
<ItemStyle Width="130px" HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblPhone2" runat="server" Text='<%# Eval("Value 2")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemStyle Width="200px" CssClass="TxtCenter" HorizontalAlign="Center" />
<ItemTemplate>
<span style="text-align: center">
<asp:LinkButton ID="OpenDialog" runat="server" CssClass="buttons" OnClientClick="showDialog('Phone-Modal','click'); return false;">Update</asp:LinkButton></span>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" HeaderStyle-HorizontalAlign="Left">
<ItemStyle Width="0" HorizontalAlign="center" />
<ItemTemplate>
<asp:HiddenField runat="server" ID="hdfl" Value='<%# Eval("ID")%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<a id="popup" href='<%# Eval("ID") %>'>Edit</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void ddlPhoneStatus_SelectedIndexChanged(object sender, EventArgs e)
{
string strTest = lblPhone.Text;
.....
}
当我单击对话框上的 DropDownList 的 SelectedIndexChanged 时,我无法将值从 jQuery 对话框获取到 C#。
谢谢你,贾汉·泽布