<asp:DetailsView ID="dlview" runat="server" Height="50px" Width="189px" 
             onmodechanging="dlview_ModeChanging" AutoGenerateRows="False">
                     <Fields>
                         <asp:TemplateField ShowHeader="False" HeaderText="编辑更新">
                             <ItemTemplate>
                             <ul>
                             <li>
                                用户名:<asp:Label ID="lblName" runat="server" Text='<%# Eval("u_Name") %>'></asp:Label>
                             </li>
                             </ul>
                                 <asp:LinkButton ID="lbtnEdit" runat="server" CausesValidation="False" 
                             CommandName="Edit" Text="编辑"></asp:LinkButton>
                             </ItemTemplate>
                             <EditItemTemplate>
                             <ul>
                             <li>
                                 <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("u_Name") %>'></asp:TextBox>
                             </li>
                             </ul>
                                 <asp:LinkButton ID="lbtnUpdate" runat="server" CausesValidation="True" 
                             CommandName="Update" Text="更新"></asp:LinkButton>
                                 <asp:LinkButton ID="lbtnCanecl" runat="server" CausesValidation="False" 
                             CommandName="Cancel" Text="取消"></asp:LinkButton>
                             </EditItemTemplate>
                         </asp:TemplateField>
                     </Fields>
                 </asp:DetailsView>
为什么我点击编辑。没反应的?我的数据源是在后台绑定的。会的朋友帮一下忙。需要触发哪一个事件?先解决点击编辑能出现编辑状态再说!!!

解决方案 »

  1.   

    <script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['form1'];
    if (!theForm) {
        theForm = document.form1;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    //]]>
    </script>
    <a href="javascript:__doPostBack('DetailsView1','Edit$0')">编辑</a>
      

  2.   

    你是用sql数据源绑定的吗?
    是的话直接在控件里updataquery写上更新语句,之后再DetailsView点击右键就会有启用编辑
    打钩就行了
      

  3.   

    你在DetailsView属性的事件里面双击他的 “编辑更新”、“删除”的事件,然后在里面写“编辑更新”、“删除”的语句,然后才能实现的!
      

  4.   

    http://www.wewill.cn/n79c13.aspx那个入门教程很老了,最好全都看完并且运行一遍然后再编写自己的asp.net程序。