asp.net/ vb.net/ gridview

I am developing an ASP.Net Website. I used GridView to display some information which in the database. Moreover, I put a button on each row in the GridView and set the CommandName of the button.

In the web page:

asp:Button ID="btnShip" runat="server" CommandArgument='<%#Eval("Invoice_No") %>' CommandName="Ship" Text="Ship" Visible="True"

And then I create a VB function to handle the GridViewCommandEventArgs of this GridView. This is the following coding:

Protected Sub Purchase_Process_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GridView1.RowCommand

If e.CommandName = "Ship" Then .....

Basically, it should do something If I press the button with CommandName "Ship". However, it doesn't work. I tried to create a empty webpage and then copy the code into that page. It was working fine for a little moment...

I also put a MsgBox() before the If statement and I found the function won't execute when I press the button in the GridView.

check in the grid properties there should be Purchase_Process_RowCommand in the ASP code

   <asp:GridView ID="Purchase_Process" runat="server"
     OnRowCommand="Purchase_Process_RowCommand">
       <asp:TemplateField>
         <ItemTemplate>
         <asp:Button runat="server" ID="Invoice" Text="Edit Information"
          CommandName="Invoice" CommandArgument=<%# Eval("Invoice_No") %> />
         </ItemTemplate>
        </asp:TemplateField>
    </asp:GridView>

暂无
暂无

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question Generic function in VB.net passing xmlnode to vb.net function Calling a VB.net Function from VBScript How to use this jquery function with vb.net Overload File Function VB.NET VB.Net Extension Function Not a Member of String Simple ASP.NET with VB.NET - Could not load type Could not upload file in mapped drive in VB.Net Calling function from VB.Net Class Object returning from Function vb.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM