did you forget "THEN"?If CType(e.CommandSource, Button).CommandName="del" THEN

解决方案 »

  1.   

    then 很重要吗??ps: 思归 GG或者JJ有没有联系工具??
      

  2.   

    还是那句话出错:(System.InvalidCastException: Specified cast is not valid.
      

  3.   

    are you using a Button? if you are, the syntax looks ok, seehttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridcommandeventargsclasscommandsourcetopic.asp
    Sub Grid_CartCommand(sender As Object, e As DataGridCommandEventArgs)
        
        If CType(e.CommandSource, Button).CommandName = "AddToCart" Then
            ' Insert code to add an item to cart.
        Else
            ' Insert code to remove an item from the cart.
        End If 
        ShoppingCart.DataBind()
    End Sub 'Grid_CartCommand 
      

  4.   

    我也就是看了这个例子写的,这句式转换类型阿——
    CType(e.CommandSource, Button)。转换成button阿<asp:ButtonColumn HeaderText="删除" Text="删除" CommandName="del" />