我只是想问一下,如何在ASP.NET中使用TextBox
TextChange Event
创建无限GridView
而不在GridView
中使用此内容,因为它会创建有限的{} TextBox
个TextChange
事件的<asp:TemplateField HeaderText="Debit">
<ItemTemplate>
<asp:TextBox ID="txtDebit1" onkeydown="tabE(this,event)" AutoPostBack="true" OnTextChanged="txtDebit1_TextChanged" CssClass="form-control" runat="server">
</asp:TextBox></ItemTemplate>
</asp:TemplateField>
个数:
$.ajax({
type: "POST",
url: '@Url.Action("testMethod")',
dataType: "json",
mtype: "post",
success: function (data) {
$("#sidebar").ace_scroll({ inline_style: true, size: 680, observeContent: true });
}
});
答案 0 :(得分:1)
这将为每个控件调用TextBox
OnChange
方法,并为您提供一个触发回发的实例。
protected void txtDebit1_TextChanged(object sender, EventArgs e)
{
GridViewRow row = ((GridViewRow)((TextBox)sender).NamingContainer);
//NamingContainer return the container that the control sits in
TextBox ctrl= (TextBox)row.FindControl("txtDebit1");
ctrk.Text = "SomeValue";
}