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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:14:41+00:00 2026-06-05T02:14:41+00:00

I apologize if this is a real simple question, but I can’t find anyone

  • 0

I apologize if this is a real simple question, but I can’t find anyone else to ask. I have a gridview with a button column. I’m trying to use the button column to send a filename to another page. I pulled this code off of another solution here, but I get an error: “Does not contain a definition for ‘Item'” on this line: ListViewDataItem item = (ListViewDataItem)e.Item; and I have no idea which Using-namespace (is that what they are called?) to use.

protected void gvFiles_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
{

    if (e.CommandName == "edit")
    {
        ListViewDataItem item = (ListViewDataItem)e.Item;

        int index = item.DataItemIndex;
        string fileID = ((ListView)sender).DataKeys[index]["fileID"].ToString();

        Response.Redirect("irMain.aspx?@filename=" + fileID);
    }
}
  • 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-05T02:14:42+00:00Added an answer on June 5, 2026 at 2:14 am

    I suppose you are dealing with a gridView not a ListView, then the code should be

    protected void gvFiles_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) 
    { 
    
        if (e.CommandName == "edit") 
        { 
            int index = Convert.ToInt32(e.CommandArgument);
            string fileID = ((GridView)sender).DataKeys[index]["fileID"].ToString(); 
            Response.Redirect("irMain.aspx?@filename=" + fileID); 
        } 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize for this seemingly relatively simple task that I can't figure out. I
I'm a total beginner so I apologize if this question is elementary. I have
I apologize up front for the broadness of this question, but I'm wondering if
This question might be very abstract, so apologize in advance. I have a log
Not sure if this will get closed as not a real question but I
I apologize for the Title of this Question, but I couldn't think of a
Python beginner here, so I apologize if this question has a simple answer. (I
Apologies if this is a duplicate question, but is there a real difference between
I apologize if this question has already been covered on this site, but I
this is a real basic question but i was struggling at it from 30

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.