formview asp.net项目返回null编辑模式 [英] formview asp.net items return null edit mode
本文介绍了formview asp.net项目返回null编辑模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试在编辑模式下获取文本框值时返回null有什么问题
when i try to get the textbox value in edit mode return null what is the problem
<asp:FormView ID="fvAdminPro" runat="server" OnModeChanging="fvAdminPro_ModeChanging" Height="277px" OnItemUpdated="fvAdminPro_ItemUpdated" OnItemUpdating="fvAdminPro_ItemUpdating" OnPageIndexChanging="fvAdminPro_PageIndexChanging" Width="88px">
<EditItemTemplate>
<asp:TextBox ID="fNametxt" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
</EditItemTemplate>
</asp:FormView>
code behinde
protected void fvAdminPro_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
string test = ((TextBox)(fvAdminPro.Row.FindControl("fNametxt"))).Text;
//test always return null
}
推荐答案
从我在MSDN上看到的:
文本框仍在更新中。 ItemUpdating事件允许您在事件发生之后进行更改。
尝试查看e.NewValues
字典。
资料来源:
DetailsViewUpdateEventArgs.NewValues Property [ ^ ]
From what I saw on MSDN:
The text box is still updating. The ItemUpdating event allows you to make changes before they are committed after the event.
Try looking at thee.NewValues
dictionary.
Source:
DetailsViewUpdateEventArgs.NewValues Property[^]
这篇关于formview asp.net项目返回null编辑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文