RageQwit
RageQwit

Reputation: 125

Remove "select" LinkButtons from GridView

I have the rows highlighted when a row is selected, but how do I remove the column that says "select" all the way down?

Upvotes: 0

Views: 1047

Answers (2)

Mubarek
Mubarek

Reputation: 2689

After you remove the Select column as suggested by jadarnel27 You can still allow users to select rows.
Use one of your other data columns as select column. I'm making the ID column a link column. Add this field and replace the ID with your dataItem

  <asp:ButtonField DataTextField="ID" HeaderText="ID" ButtonType="Link" CommandName="Select" />

Upvotes: 1

Josh Darnell
Josh Darnell

Reputation: 11433

If you have this in the <columns> collection of your Gridview markup, you need to remove it:

<asp:CommandField ShowSelectButton="True" />

If you have this in your GridView markup (the declaration of the GridView itself), you need to remove it:

AutoGenerateSelectButton="True"

Or, if you want to remove it in code-behind in response to something, you can do this:

GridView1.Columns.RemoveAt(columnIndex);

Where columnIndex is an int that represents the index of the column where the "Select" LinkButtons are.

If you would like to provide more details in your question, I'd be glad to be more specific =)

Upvotes: 3

Related Questions