Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sean,</p> <p>I understand you have the answer now but for future references you would have to create an addhandler and a delegate to do what you wanted to do. I misunderstood the question at first. But here's what you would do if you chose not to use a command field.</p> <p>//This is in pageload<br></p> <pre><code>If Not IsPostBack Then 'Create new column for Edit buttons 'Dim field As New TemplateField Dim actionfield As New TemplateField actionfield.HeaderText = "Action" Dim actioncol As DataControlField = actionfield GridView1.Columns.Insert(8, actioncol)//the eight is the column number of where you are adding the column. below you will add the button. You really don't need to add this column programmtically. I normally do though. End If </code></pre> <p>//rowcreated</p> <pre><code> If e.Row.RowType &lt;&gt; DataControlRowType.footer Then btnedit.ToolTip = "Edits the Current Record" btnedit.ImageUrl = "\images\bttnEditMini.gif" GridView1.Rows(i).Cells(8).Controls.Add(btnedit) btnedit.CommandName = "view"//notice commandname. You can manipulate it. btnedit.CommandArgument = GridView1.Rows(i).Cells(0).Text AddHandler btnedit.Click, AddressOf btnedit_Click end if </code></pre> <p>//then notice you must create an imageclickeventhandler delegate</p> <pre><code> Public Delegate Sub ImageClickEventHandler(ByVal sender As Object, ByVal e As ImageClickEventArgs) Sub btnedit_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs) //whatever actions you need to take. end sub </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload