我有一个gridview,其中包含如下列。这些列的文本框的autopostback = true,需要在gridview的RowDataBound中获取它们的值。问题是,当您在文本框中键入内容并将焦点从中删除时,会出现在RowDataBound网格中,但输入的值未被捕获(= /)
帮我解决这个问题,还有更多工作要做。我不能使用jquery或任何东西,只有TextChanged的一些文本框gridview来获取值。
代码:
<Columns>
<asp:TemplateField HeaderText="Entrada">
<ItemTemplate>
<asp:TextBox ID="txtEmanha_g" AutoPostback="true" class="Mask"
Width="40px" runat="server"
Text='<%#Eval("ENTRADA") %>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
答案 0 :(得分:0)
您需要将GridView设置为可编辑并利用EditItemTemplate。这是一个有效的例子:
Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List
答案 1 :(得分:0)
试试这个:
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
// Bind grid here only on page load not every post back to the server
}
}