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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:39:42+00:00 2026-06-17T17:39:42+00:00

I have a page status.aspx that contains several buttons such as 30 days, 60

  • 0

I have a page status.aspx that contains several buttons such as 30 days, 60 days & 90 days. I would like to pass the parameters to my existing gridview depending on which button has been clicked. My code behide for the gridview as follows:

    Dim cmd As SqlCommand = New SqlCommand("up_AcctStatus", conn)
    cmd.CommandType = CommandType.StoredProcedure

    Dim paramNumOfDays As New SqlParameter("@NumOfDays", SqlDbType.Int)
    paramNumOfDays.Value = "??? 30, 60 or 90 ???"
    cmd.Parameters.Add(paramNumOfDays)

GridView1.DataSource = cmd.ExecuteReader()
GridView1.DataBind()

  • 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-17T17:39:44+00:00Added an answer on June 17, 2026 at 5:39 pm

    If you don’t want to use any ORM but sqlComand you can:

                protected void Button1_Click(object sender, EventArgs e)
                {
                    Fill(60);
                }
                protected void Button2_Click(object sender, EventArgs e)
                {
                    Fill(30);
                }
    
                private void Fill(int numberOfDays)
                {
                    using (SqlConnection connection = new SqlConnection("connectionString"))
                    {
                        connection.Open();
    
                        SqlDataAdapter sda = new SqlDataAdapter();
                        sda.SelectCommand = new SqlCommand("stored procedure name", connection);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.AddWithValue("@NumOfDays", numberOfDays);
    
                        DataSet ds = new DataSet();
                        sda.Fill(ds, "result_table");
    
                        GridView1.DataSource = ds.Tables["result_table"];
                        GridView1.DataBind();
                    }
                }
    

    vb:

                    Protected Sub Button1_Click(sender As Object, e As EventArgs)
                    Fill(60)
                    End Sub
    
                    Protected Sub Button2_Click(sender As Object, e As EventArgs)
                        Fill(30)
                    End Sub
    
                    Private Sub Fill(numberOfDays As Integer)
                        Using connection As New SqlConnection("connectionString")
                            connection.Open()
    
                            Dim sda As New SqlDataAdapter()
                            sda.SelectCommand = New SqlCommand("stored procedure name", connection)
                            sda.SelectCommand.CommandType = CommandType.StoredProcedure
                            sda.SelectCommand.Parameters.AddWithValue("@NumOfDays", numberOfDays)
    
                            Dim ds As New DataSet()
                            sda.Fill(ds, "result_table")
    
                            GridView1.DataSource = ds.Tables("result_table")
                             GridView1.DataBind()
                        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 been creating an order status ASPX page that shows the Date, Carrier,
Within an ASPX page, I would like to have the popup shown within the
I have a shopping cart page (Cart.aspx) that has a button that will (sometimes)
I have gridview that is loaded from another aspx page after an ajax call,
I have an aspx page that makes an Ajax request (using jquery) to a
I have a page ( somePage.aspx ) and I need the content that has
I have an ASPX page that makes a lot of database queries that I
I have an aspx page that returns valid JSON - however when called via
I have a page named A.aspx that loads a B.aspx using the load jQuery
I have page (Default1.aspx) in which I am redirecting to another page (Default2.aspx) using

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.