我有一段代码可以使用自动填充获取客户详细信息。它正在返回数据,我可以看到它,但是当我尝试保存数据时(单击“保存”按钮),它会删除文本框数据并变为空。
代码背后:
$(".custid").autocomplete("../Ajax/get-customer-list.aspx", {
width: 330, selectFirst: false, scrollHeight: 90, mustMach: true
});
$(".custid").result(function (event, data, formatted) {
if (data) {
$(".custid").val(data[1].trim());
$(".cusname").val(data[0].trim());
$(".cusmobile").val(data[2].trim());
$(".txtOther").focus();
}
});
并在控件上。
<div class="label-item">
<asp:Label ID="Label10" runat="server" Text="Search Name"></asp:Label>
</div>
<div class="control-item>">
<asp:TextBox ID="txtCustID" runat="server" CssClass="custid" Width="126px"></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="server" CssClass="cusname" ReadOnly="True" Width="280px"></asp:TextBox>
</div>
<div class="clear"></div>
<div class="label-item">
<asp:Label ID="Label4" runat="server" Text="Customer Name"></asp:Label>
</div>
<div class="control-item">
<asp:TextBox ID="txtCustName" CssClass="cusname" runat="server" Width="150px" Enabled="False"></asp:TextBox>
</div>
<div class="clear"></div>
<div>
</div>
<div class="label-item">
<asp:Label ID="Label5" runat="server" Text="Mobile Number"></asp:Label>
</div>
<div class="control-item">
<asp:TextBox ID="txtCustomerMobile" runat="server" cssClass="cusmobile" Width="201px" Enabled="False"></asp:TextBox>
</div>
<div class="clear"></div>
<div class="label-item">
<asp:Label ID="Label6" runat="server" Text="Email"></asp:Label>
</div>
<div class="control-item">
<asp:TextBox ID="txtEmail" runat="server" Width="201px" Enabled="False"></asp:TextBox>
</div>
<div class="clear"></div>
</div>