日期:2014-05-17  浏览次数:20379 次

asp.net detailsview点击编辑不显示更新,取消按钮
<asp:DetailsView ID="DetailsViewAdNote" runat="server" Height="50px" 
  Width="325px" AutoGenerateRows="False" onitemcommand="DetailsViewAdNote_ItemCommand" 
  onmodechanging="DetailsViewAdNote_ModeChanging" Font-Size="12px" 
  onitemupdating="DetailsViewAdNote_ItemUpdating" DataKeyNames="admin_id">
  <Fields>
  <asp:BoundField HeaderText="人员姓名" DataField="admin_name" />
  <asp:BoundField HeaderText="登陆密码" DataField="admin_pass" />
  <asp:BoundField HeaderText="管理权限" DataField="mgSystem"/>
  <asp:BoundField HeaderText="mg问题" DataField="mgquestions" />
  <asp:BoundField HeaderText="mg学生" DataField="mgStudents" />
  <asp:CommandField HeaderText="编辑" ShowEditButton="true" />
  </Fields>
  </asp:DetailsView>






code:
protected void DetailsViewAdNote_ModeChanging(object sender, DetailsViewModeEventArgs e)
  {
  DetailsViewAdNote.ChangeMode(e.NewMode);
  Bind();
  }
ublic void Bind()
  {
  string str_id = Request["title"];
  DetailsViewAdNote.DataSource = BuildSQLString.GetDataTable("exam_admin", "admin_id", str_id);
  DetailsViewAdNote.DataBind();
  }

------解决方案--------------------
你太懒了:百度下:DetailsView的ItemTemplate与EditItemTemplate切换