C# 无法在用户控件按钮单击中获取输入值
当我点击位于usercontrol内的按钮时,我不会得到在Button click事件中输入到文本框中的值。请提出任何替代方案 我的UserControl标记:C# 无法在用户控件按钮单击中获取输入值,c#,asp.net,web,user-controls,C#,Asp.net,Web,User Controls,当我点击位于usercontrol内的按钮时,我不会得到在Button click事件中输入到文本框中的值。请提出任何替代方案 我的UserControl标记: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SearchPopup.ascx.cs" Inherits="trg.dgs.sites.web.ui.ui.charternew.usercontrol.SearchPopup" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SearchPopup.ascx.cs"
Inherits="trg.dgs.sites.web.ui.ui.charternew.usercontrol.SearchPopup" %>
<script type="text/javascript">
// function searchPopuptester() {
// debugger;
// var address = document.getElementById('<%= txtAddress.ClientID %>').value;
// //alert(address);
// var zip = document.getElementById('<%= txtZip.ClientID %>').value;
// // alert(zip);
// var aptnum = document.getElementById('<%= txtSuite.ClientID %>').value;
// alert(aptnum);
// debugger;
// $.ajax({
// type: "GET",
// url: "ui/charternew/usercontrol/SearchPopup.ascx/SearchAddress",
// data: [{ address: address, suite: aptnum, zip: zip}],
// datatype: "json",
// success: function (data) {
// window.location = data.d;
// },
// failure: function () {
// alert("Sorry,there is a error!");
// }
// });
// }
</script>
<div class="form_wrapper">
<div class="formarea">
<div class="form_heading">
<h4>
Check Service Availability</h4>
<p>
TO FIND THE BEST DEALS IN YOUR AREA</p>
</div>
dddddddddddd
<p>
<img src="ui/charternew/images/lock_icon.png" alt="Lock Icon" class="lock_icon" />Your
Information is Private and Secure</p>
<div class="feild_set">
<div class="feild_bar">
<asp:TextBox ID="txtAddress" runat="server" MaxLength="30" CssClass="feild1" />
</div>
<div class="feild_bar">
<div class="apt_feild">
<asp:TextBox ID="txtSuite" runat="server" MaxLength="25" CssClass="feild2" />
</div>
<div class="zipcode_feild">
<asp:TextBox ID="txtZip" runat="server" MaxLength="5" CssClass="feild2" />
</div>
</div>
<div class="feild_bar">
<asp:CheckBox ID="Ismoving" CssClass="tflables" TextAlign="right" runat="server"
Checked="false" />
<label>
Moving?</label>
<label id="lblMoveDate" style="display: none;">
<asp:TextBox ID="txtmovedate" runat="server" CssClass="txtfield" MaxLength="50" />
</label>
</div>
<asp:LinkButton ID="btnSubmit" runat="server" CssClass="btn" OnClick="btnSubmit_Click">Find My BEST Deals</asp:LinkButton>
</div>
<!-- End Form -->
</div>
</div>
页面或用户控件上的按钮控件在哪里javascript:search()做了什么;返回false;您的代码中有什么内容?@Alborz请忽略javascript:search();返回false。此函数是commented@geek按钮控件位于usercontrol中。请粘贴完整的标记
protected void btnSubmit_Click(object sender, EventArgs e)
{
string add = txtAddress.Text; }