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 8783767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:54:37+00:00 2026-06-13T20:54:37+00:00

I have a grid view which pulls through data dictated by a stored procedure.

  • 0

I have a grid view which pulls through data dictated by a stored procedure.

screen shot 1

The stored procedure is called GetEverything.
The statement is made up of information from 2 tables, one with person detail, and one with vessel detail. The stored procedure select statement contains the following Where clause:

WHERE Vessel.ArchiveStatus = 0

By default, every new record that is created using the front end application is given a ‘0’ for ArchiveStatus in the db.

So, the gridview will only show me the records where the ArchiveStatus is 0, which by default is evertything.

The 2 boxes, Check All and Uncheck All are working fully.

What I need now is when a REF or REF(s) are selected and the button ‘Archive Records’ is clicked, for the 0 in the database to be updated to a 1 for that VesselREF.

Can anoyone advise how to do this and give me some example code to put in the Default.aspx.vb file/ Event Handler for the archive records button.

With this is place, the grid view will only display the non-archived records, and I can create a seperate grid view with its own SQL to bring through the archived records.

GridView.aspx

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="REF,VesselREF" DataSourceID="SqlDataSource1" Height="132px" 
        style="text-align: center; font-family: Calibri; font-size: medium" 
        Width="508px" BackColor="#C4FFC4">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="REF" InsertVisible="False" SortExpression="REF">

                <ItemTemplate>
                    <a href="Details.aspx?REF=<%# Eval("REF")%>"><%# Eval("REF")%></a>
                    <asp:CheckBox ID="RecordSelector" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="Surname" HeaderText="Surname" 
                SortExpression="Surname" />
            <asp:BoundField DataField="VesselName" HeaderText="VesselName" 
                SortExpression="VesselName" />
            <asp:BoundField DataField="VesselREF" HeaderText="VesselREF" 
                InsertVisible="False" ReadOnly="True" SortExpression="VesselREF" />

        </Columns>
    </asp:GridView>
  • 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-13T20:54:38+00:00Added an answer on June 13, 2026 at 8:54 pm

    Assuming you’re using TemplateFields and you want to use your stored-procedure to set both archived states:

    Protected Sub btnArchive_Clicked(sender As Object, e As EventArgs)Handles btnArchive.Clicked
        For Each row As GridViewRow In GridView1.Rows
            Dim chk As CheckBox = DirectCast(row.FindControl("ChkRef"), CheckBox)
            If (chk.Checked) Then
                Dim refID As Integer = Integer.Parse(row.Cells(5).Text)
                ArchiveRecord(refID, True)
            End If
        Next
    End Sub
    
    Public Shared Sub ArchiveRecord(refID As Integer, archive As Boolean)
        Using con = New SqlConnection(My.Settings.MyConnectionString)
            Using cmd = New SqlCommand("StoredProcedureName", con)
                cmd.CommandType = CommandType.StoredProcedure
                cmd.Parameters.AddWithValue("@RefID", refID)
                cmd.Parameters.AddWithValue("@Archive", archive)
                con.Open()
                Dim affectedrecordCount As Integer = cmd.ExecuteNonQuery()
            End Using
        End Using
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid view which I am binding with data table. My problem
I have a grid view which uses SQL to calculate information that I need!
I have a grid view which contains a button in a template field. I
In my project I have a grid view which contains images. Based on my
I have a GridView in which each row has a custom view. The grid
Hi I have a grid view which is dynamically generated via C# using a
I am currently developing an ASP.net c# application. I have a grid view which
I have a grid view which contains some sequence numbers. Each column needs to
I have a grid table, which I do data binding on page load if
I have an image in a view which contains a 9x9 grid. I want

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.