日期:2014-05-18  浏览次数:20441 次

DetailsView的wasn't handled问题
郁闷,baidu不到,只好来问了.
错误提示是The   DetailsView   'DetailsView1 '   fired   event   ModeChanging   which   wasn 't   handled

首先,第一次进入页面没问题,能显示DetailsView   ,但是我一点击Edit   User   Info就出错.
我DetailsView   没有DataSourceID,直接绑到了一个ArrayList上,难道这就是出错的原因??难道是OnItemUpdating事件有错??首先名字什么的绝对是匹配,然后OnItemUpdating事件里的代码我是直接抄的,原代码都没有问题,怎么抄过来就有问题了?只不过原代码DetailsView   是有DataSourceID   而已.

下面这个是DetailsView   的代码
<asp:DetailsView   AutoGenerateRows= "False "   ID= "DetailsView1 "   runat= "server "   OnItemUpdating= "DetailsView1_ItemUpdating1 "   >
<Fields>
<asp:BoundField   DataField= "UserName "   HeaderText= "User   Name "   ReadOnly= "True "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem ">
</asp:BoundField>
<asp:BoundField   DataField= "Email "   HeaderText= "Email "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "> </asp:BoundField>
<asp:BoundField   DataField= "Comment "   HeaderText= "Comment "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "> </asp:BoundField>
<asp:CheckBoxField   DataField= "IsApproved "   HeaderText= "Active   User "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "   />
<asp:CheckBoxField   DataField= "IsLockedOut "   HeaderText= "Is   Locked   Out "   ReadOnly= "true "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "   />

<asp:CheckBoxField   DataField= "IsOnline "   HeaderText= "Is   Online "   ReadOnly= "True "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "   />
<asp:BoundField   DataField= "CreationDate "   HeaderText= "CreationDate "   ReadOnly= "True "
  HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "> </asp:BoundField>
<asp:BoundField   DataField= "LastActivityDate "   HeaderText= "LastActivityDate "   ReadOnly= "True "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem ">
</asp:BoundField>
<asp:BoundField   DataField= "LastLoginDate "   HeaderText= "LastLoginDate "   ReadOnly= "True "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem ">
</asp:BoundField>
<asp:BoundField   DataField= "LastLockoutDate "   HeaderText= "LastLockoutDate "   ReadOnly= "True "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "> </asp:BoundField>
<asp:BoundField   DataField= "LastPasswordChangedDate "   HeaderText= "LastPasswordChangedDate "
ReadOnly= "True "   HeaderStyle-CssClass= "detailheader "   ItemStyle-CssClass= "detailitem "> </asp:BoundField>
<asp:CommandField   ButtonType= "button "   ShowEditButton= "true