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
159 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

695 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