日期:2014-05-19  浏览次数:20952 次

怎么获得girdview 里删除这行的id !!
怎么获得girdview   里删除这行的id   !!这里有个嵌套,怎么得到id,我好删除    

<asp:TemplateField   HeaderText= "操作 ">
          <ItemTemplate>
              <asp:HyperLink   ID= "HyperLink2 "   runat= "server "   NavigateUrl= ' <%#   Eval( "VoteID ",   "/Web/admin/Message.aspx?VoteID={0} ")   %> '> 留言 </asp:HyperLink>
              <asp:HyperLink   ID= "HyperLink3 "   runat= "server "   NavigateUrl= ' <%#   Eval( "VoteID ",   "/Web/admin/AddSingle.aspx?action=edit&VoteID={0} ")   %> '> 修改 </asp:HyperLink>
              <asp:LinkButton   ID= "delbtn "   runat= "server "   CausesValidation= "false "     CommandName= "delete "   Text= "删除 "   onClientClick= "return       confirm( '确定要删除吗? ') "     > </asp:LinkButton>
        </ItemTemplate>
    </asp:TemplateField>

------解决方案--------------------
<asp:LinkButton ID= "delbtn " runat= "server " CausesValidation= "false " CommandName= "delete " CommandArgument= ' <%# Eval( "id ") %> ' Text= "删除 " onClientClick= "return confirm( '确定要删除吗? ') " > </asp:LinkButton>


cs
deleteCommand事件
e.argument 的值 就为ID的值