Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8554231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:50:03+00:00 2026-06-11T14:50:03+00:00

Im trying to add buttons or link to a gridview so i can edit/delete/update

  • 0

Im trying to add buttons or link to a gridview so i can edit/delete/update records, but i cant add it, i have tryed many things but i get errors can someone help me. !?
I can show the records/date in the gridview, but i cant see how to add the button events.

My front_code is:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Data_Adapter_Grid.aspx.vb" Inherits="Data_Adapter_Grid" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
        CellPadding="4" DataKeyNames="test_id" ForeColor="Black" GridLines="Horizontal">
    <Columns>
        <asp:BoundField DataField="test_id" HeaderText="test_id" InsertVisible="False"
            ReadOnly="True" SortExpression="test_id" />
        <asp:BoundField DataField="test_cat" HeaderText="test_cat"
            SortExpression="test_cat" />
        <asp:BoundField DataField="test_info" HeaderText="test_info"
            SortExpression="test_info" />
        <asp:BoundField DataField="test_number" HeaderText="test_number"
            SortExpression="test_number" />
    </Columns>
    <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
    <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
    <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
    <SortedAscendingCellStyle BackColor="#F7F7F7" />
    <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
    <SortedDescendingCellStyle BackColor="#E5E5E5" />
    <SortedDescendingHeaderStyle BackColor="#242121" />
    </asp:GridView>
</div>
</form>
</body>
</html>

My behind_code is:

Imports System.Data.OleDb
Imports System.Data

Partial Class Data_Adapter_Grid
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
        Call GetRecords()
    End If
End Sub
' "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='C:\Users\Peter\Documents\Visual Studio 2010\Projects\StockIT\StockIT\bin\Debug\StockManagement.accdb';Persist Security Info=True;Jet OLEDB:Database Password="
'Get all Records

Sub GetRecords()
    Dim strSQL As String = ""
    strSQL = "" & _
    "SELECT * FROM [TableTest] " & _
    "ORDER BY [test_id] ASC"

    Dim dt As New DataTable()
    Using conn As New OleDbConnection(ConfigurationManager.ConnectionStrings("MyConnStr").ConnectionString)
        Try
            conn.Open()
            Dim cmd As New OleDbCommand(strSQL, conn)
            Dim dbAdapter As New OleDbDataAdapter(cmd)
            'Dim cb As New OleDbCommandBuilder(dbAdapter)
            dbAdapter.Fill(dt)  '(dt, "GridLoad")
            dbAdapter.Dispose()
            If dt.Rows.Count > 0 Then
                GridView1.DataSource = dt
                'GridView1.DataMember = "GridLoad"
                GridView1.DataBind()
            End If
        Catch exp As OleDbException
            If True Then
                MsgBox("Error trying to get records, maybe there is no records. " & vbCrLf & "Error: " & exp.Message & "Database Error", MsgBoxStyle.OkOnly, MsgBoxStyle.Critical)
            End If
        Catch exp As Exception
            If True Then
                MsgBox("Error the Database can be unavailable atm. " & vbCrLf & "Error: " & exp.Message & "Database Error", MsgBoxStyle.OkOnly, MsgBoxStyle.Information)
            End If
        End Try
    End Using
End Sub

Protected Sub GridView1_RowEditing(sender As Object, e As GridViewEditEventArgs)

End Sub

Protected Sub GridView1_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs)

End Sub

Protected Sub GridView1_RowUpdating(sender As Object, e As GridViewUpdateEventArgs)

End Sub

Protected Sub GridView1_RowDelete(sender As Object, e As GridViewDeletedEventArgs)

End Sub


End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:50:04+00:00Added an answer on June 11, 2026 at 2:50 pm

    try <asp:templatefield> // add button or link inside </asp:templatefield> call button onrowcommand event, read it to make yourself clear http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add control buttons on to the jQuery UI slider but can't
I am trying to add events on my buttons inside a list, but it
I have been trying to add an askquestion dialog box to a delete button
I have a toggle script that works great, but I'm trying to add a
I'm trying yo add text to the editor using some buttons, So actualy I've
I have a box where I am trying to add a button to the
I'm trying to get a Gridview select link to drill down to a specific
I'm trying to add a link to a Rails view to set a boolean
Im trying to add a UIAlertView to warn the user that the link will
i have a page at this link and im trying to get the test

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.