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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:19:21+00:00 2026-05-21T11:19:21+00:00

I have a GridView that is built from a Linq query as follows var

  • 0

I have a GridView that is built from a Linq query as follows

var GridViewLoad = from d in QVuser.QlikViewDashboards.AsEnumerable()
     join p in tempPermissions.AsEnumerable() on d.DashboardId equals Convert.ToInt32(p["DashboardId"])
     where  Convert.ToInt32(p["UserId"]) == GridViewUser
     select new 
     {
         DashboardId = d.DashboardId,
         PermissionId = Convert.ToInt32(p["PermissionId"]),
         DashboardName = d.DashboardName,
         Operational_Unit = p["Operational_Unit"].ToString(),
         Cost_Centre = p["Cost_Centre"].ToString(),
         Project = p["Project"].ToString(),
         Fund = p["Fund"].ToString()
     };

GridView1.DataSource = GridViewLoad; 
GridView1.DataKeyNames = new string[] {"PermissionId"};
GridView1.DataBind();

Then the GridView is defined as:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3" 
    GridLines="Vertical" ShowHeaderWhenEmpty="True" OnRowDeleting="GridView1_RowDeleting"
        style="text-align: center" BackColor="White" BorderColor="#999999" 
    BorderStyle="None" BorderWidth="1px" Width="550px" 
   >
<AlternatingRowStyle BackColor="#DCDCDC" />
<Columns>
    <asp:TemplateField HeaderText="Delete" ShowHeader="False">
        <ItemTemplate>
            <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="false" 
                CommandArgument='<%# Eval("PermissionId") %>' CommandName="Delete" Text="Delete"></asp:LinkButton>
        </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="PermissionId" HeaderText="ID"/>
    <asp:BoundField DataField="DashboardName" HeaderText="Dashboard" ReadOnly="True" SortExpression="DashboardName" />
    <asp:BoundField DataField="Operational_Unit" HeaderText="Operational_Unit" ReadOnly="True" SortExpression="Operational_Unit" />
    <asp:BoundField DataField="Cost_Centre" HeaderText="Cost_Centre" ReadOnly="True" SortExpression="Cost_Centre" />
    <asp:BoundField DataField="Fund" HeaderText="Fund" ReadOnly="True" SortExpression="Fund" />
    <asp:BoundField DataField="Project" HeaderText="Project" ReadOnly="True" SortExpression="Project" />

</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" BorderStyle="Solid" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" BorderStyle="Solid" 
    BorderWidth="1px" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />

What I want to do is hide the PermissionId field from sight, but it obviously still needs to be there for the Delete button to work..

Can someone help me out with this?

I’ve tried setting Visible=”false”, which hides it, but then my delete button stops working..

Cheers for your help..

  • 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-05-21T11:19:21+00:00Added an answer on May 21, 2026 at 11:19 am

    Since you’re setting the DataKeyNames, you should be able to retrieve the permission ID from the index of the row being deleted, like so:

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int permissionId = (int)GridView1.DataKeys[e.RowIndex].Value;
    
        DoDelete(permissionId);
    }
    

    This should work whether the column is visible or not.

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

Sidebar

Related Questions

I have a gridview that contains value of every rows read from a text
I have built a gridview that includes one bound column on the far left
Does .NET have some type of built in function that allows filtering on Gridviews?
I have a gridview that shows an image as part of one of its
I have a gridview that displays items details, I added two template fields one
I have a gridview that is only shown in a modal popup. right before
I have a GridView that I need to dynamically add TemplateField elements to. My
I have a gridview that is bound to a datasource on a Windows Form
I have a gridview that is bound to a datasource (Windows Forms, VB.NET). One
I have a GridView that has 3 columns: FirstName, LastName and a TemplateField FullName

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.