我正在开发一个最终用于联系人目录的测试模式。单击按钮时,变量(电子邮件地址)将传递到AccountsDB对象中的子GetSpecificAccount。在测试模式中,我已经硬编码了要传递的电子邮件地址以使其更容易;但是,当我单击按钮时,内容不会加载。
<center><asp:Button ID="btnTestButton" CssClass="btn btn-primary" runat="server" OnClick="UpdateModal" OnClientClick="ShowModal(); return false" Text="Test Modal" /></center>
</div>
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><asp:Label runat="server" ID="lblName" Text="Name Placeholder" /></h3>
</div>
<div class="modal-body">
<p><b>Name: </b> <asp:Label runat="server" ID="lblName2" Text="Name Placeholder" /></p>
<p><b>Email: </b> <asp:Label runat="server" ID="lblEmail" Text="Email Placeholder" /></p>
<p><b>Info: </b> <asp:Label runat="server" ID="lblInfo" Text="Info Placeholder" /></p>
</div>
<div class="modal-footer">
<asp:HyperLink runat="server" cssclass="btn btn-primary" URL="">Contact</asp:HyperLink>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
function ShowModal() {
$(document).ready(function () {
$('#myModal').modal('show');
});
}
</script>
Protected Sub UpdateModal()
AccountsDB.GetSpecificAccount("test@test.com")
lblName.Text = AccountsDB.AccountsDataset.Tables("Accounts").Rows(0).Item("FirstName").ToString
lblEmail.Text = AccountsDB.AccountsDataset.Tables("Accounts").Rows(0).Item("email").ToString
lblName2.Text = AccountsDB.AccountsDataset.Tables("Accounts").Rows(0).Item("FirstName").ToString & " " & AccountsDB.AccountsDataset.Tables("Accounts").Rows(0).Item("LastName").ToString
lblInfo.Text = "Test info hardcode"
End Sub
答案 0 :(得分:0)
当您点击按钮时,数据不会在服务器上发送(因为&#39;返回false;&#39;)。