Solved

I have an edit button set up as a template field within a gridview and i want to edit that row if it is clicked but it is not firing the rowcomand event in the gridview.

Posted on 2014-11-28
2
156 Views
Last Modified: 2014-12-01
aspx file:

<asp:TemplateField>
              <ItemTemplate>
                    <asp:Button ID="edit" runat="server"
                        CommandName="EditMilestones"
                        CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                        Text="Edit" />
                </ItemTemplate>
            </asp:TemplateField>

code behind file

Protected Sub GrdVisualObjectives_RowCommand(ByVal sender As Object, _
          ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)
        If (e.CommandName = "EditMilestones") Then
            ' Retrieve the row index stored in the CommandArgument property.
            Dim index As Integer = Convert.ToInt32(e.CommandArgument)

            ' Retrieve the row that contains the button
            ' from the Rows collection.
            Dim row As GridViewRow = GrdVisualObjectives.Rows(index)

            ' Add code here to add the item to the shopping cart.

        End If
    End Sub
0
Comment
Question by:MartinChadderton
2 Comments
 
LVL 5

Accepted Solution

by:
ashokpumca earned 500 total points
ID: 40471501
0
 
LVL 1

Author Comment

by:MartinChadderton
ID: 40473383
It did
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET - Error - Object not set in Module 4 40
QQ problem 22 43
Open a link in vb.net 2 16
Must we use a disconnected model when creating database applications? 6 17
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question