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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:09:40+00:00 2026-06-15T13:09:40+00:00

I have a gridview with selection enabled, I also added a button under it

  • 0

I have a gridview with selection enabled, I also added a button under it that is supposed to take the user to another page with a formview waiting to display the selected record’s complete information. How do i pass the ID as a query string and use it in the sqldatasource in the other page?

My gridview has

ID
Name

The formview will show

ID
Name
Description
Uploader
Audience
Category
  • 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-15T13:09:42+00:00Added an answer on June 15, 2026 at 1:09 pm

    You could take the value from the selected row and redirect on post back.

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selectedrow.aspx

      Sub CustomersGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        Dim row As GridViewRow = CustomersGridView.SelectedRow
        Response.redirect(String.Format("detailsPage.aspx?id={0}", row.cells(x).text))
      End Sub
    
      void CustomersGridView_SelectedIndexChanged(Object sender, EventArgs e)
      {
         GridViewRow row = CustomersGridView.SelectedRow;
         Response.Redirect(String.Format("detailsPage.aspx?id={0}", row.cells[x].text));
    
      }
    

    Where x is the cell that holds the ID

    On the details page assuming a stored procedure:

    Dim aSource As New SqlDataSource
     aSource.ConnectionString = {your connection string})
     aSource.ProviderName = "System.Data.SqlClient"
     aSource.SelectCommand = {Your stored procedure name}
     aSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
     aSource.SelectParameters.Add(New System.Web.UI.WebControls.Parameter("ID", Data.DbType.String, Request.QueryString(0)))
    
     SqlDataSource aSource;
     aSource.ConnectionString = {your connection string});
     aSource.ProviderName = "System.Data.SqlClient";
     aSource.SelectCommand = {Your stored procedure name};
     aSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
     aSource.SelectParameters.Add(New System.Web.UI.WebControls.Parameter("ID", Data.DbType.String, Request.QueryString[0]));
    

    EDIT: From seeing your response to another answer:

    I am fairly certain that the selected row should be visible to your submit function as well.

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

Sidebar

Related Questions

I have got a devexpress gridview with Selection Enabled. Is it possible that, on
I have a GridView in a page with paging enabled (sorting not enabled, not
I have a gridview with row selection which should set the page's elements value
I have a gridview that is using a LinqDataSource for it's datasource. I've added
I have GridView on my page: <%@ Page Language=C# AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default %> <!DOCTYPE
I have a gridview and I have a button on it.I want, if the
I have a gridview that needs to be exported to Excel. I have managed
I enabled the selection on my gridview. The question is, I can pass values
I have a GridView on Android I populate with custom images. When the user
I have a GridView that is bound to an ObjectDataSource, and I am handling

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.