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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:51:23+00:00 2026-06-09T04:51:23+00:00

I have a grid view. I want to take the selected row from the

  • 0

I have a grid view.
I want to take the selected row from the grid view and pass on a column value in that row to a new page while storing that value in the session.

So far I know how to store it as a string from a tut, but don’t know how to keep the value in int format not convert it to string.

Here is what I have in my C# code…Like I said this does write out the row as a string type I want it to remain a int.

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            Int16 num = Convert.ToInt16(e.CommandArgument);
            TextBox2.Text = GridView1.Rows[num].Cells[0].Text;

        }
    }

Putting it into session will be easy. I figured out it is:

Session["customerID"] =  GridView1.Rows[num].Cells[0].Text;

So now the true question is how to keep the value in a int format.

Thanks!

  • 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-09T04:51:24+00:00Added an answer on June 9, 2026 at 4:51 am

    You can not save it in int type directly.Session stores the value in object type. So you have to cast it as int.

    int customerID = (int) Session["customerID"];
          // or
    int customerID = Convert.ToInt32( Session["customerID"].ToString());
         // or
    int customerID = int.Parse( Session["customerID"].ToString());
    
    • 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 on my page and I want to export it
I have a Grid View. I added AutoGenerateEditButton=True . I want to display that
I have a list of images in grid view.I want to display a gallery
I have used this custom grid view in my code, and I want to
I've got a grid view. I want it to say you have nothing to
I have a grid view will two different button columns. I want to perform
I have a asp.net application in that I have grid view and I export
I have grid view and now i want to set specific width for each
I have a grid view utilizing sql data source. Now I want to delete
I have one grid view which i want to add in footer of listview

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.