我需要解释我的问题...当我单击弹出模式中的保存按钮时,“弹出模式中的文本框总是返回空”。我需要获取 txtCityName.Text 和 txtCityDescription.Text 的值;
here's my code...
======================
THE HTML
=======================
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="modal.aspx.cs" Inherits="sample.modal" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="DivModifyCity" runat="server" class="modal" style="overflow: hidden; margin-top: 50px; display: none">
<div class="modal-header">
<div style="display: inline-block;" class="pull-right ">
<asp:LinkButton ID="lnkCloseCity" runat="server" CssClass="icon-remove" ToolTip="Close" data-dismiss="modal" aria-hidden="true" type="button" value="Close" Height="20px"></asp:LinkButton>
</div>
<h3>
<asp:Label ID="lblCityStatus" runat="server" Text="Add City"></asp:Label></h3>
</div>
<div class="modal-body">
<table cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td> </td>
<td class="input-medium" style="width: 140px"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="input-medium" style="width: 140px">
<asp:Label ID="Label8" runat="server" Text="City Name" Font-Size="12pt"></asp:Label></td>
<td>
<asp:TextBox ID="txtCityName" type="text" placeholder="City Name" runat="server" MaxLength="150"></asp:TextBox></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="input-medium" style="width: 140px"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="input-medium" style="width: 140px">
<asp:Label ID="Label9" runat="server" Text="City Description" Font-Size="12pt"></asp:Label></td>
<td>
<asp:TextBox ID="txtCityDescription" type="text" runat="server" placeholder="Description" Height="50px" TextMode="MultiLine"></asp:TextBox></td>
<td> </td>
</tr>
</table>
</div>
<div class="modal-footer">
<asp:LinkButton ID="lnkSaveCity" runat="server" Font-Underline="false" Font-Bold="true" Text="Save" CssClass="btn btn-primary" Height="20px" ToolTip="Add new city" OnClick="btnSaveCity_Click"></asp:LinkButton>
</div>
</div>
<a data-toggle="modal" href="#DivModifyCity" class="btn btn-primary btn-lg">Launch demo modal</a>
</form>
<%-- modal popup--%>
<link href="bootstrap/css/bootstrap.css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<link href="../Scripts/css/bootstrap.css" rel="stylesheet" />
<script src="../Scripts/js/bootstrap-modal.js"></script>
<%-- end here--%>
</body>
</html>
=========================
server side code:
=========================
protected void btnSaveCity_Click(object sender, EventArgs e)
{
string try1 = txtCityName.Text;
string try2 = txtCityDescription.Text;
}