Solved

Gridview Duplicate Columns When Datatable set as datasource programatically and bound fields used

Posted on 2010-11-15
1
968 Views
Last Modified: 2012-05-10
I am trying to add a button field to a gridview that I am populating with a datatable.  I would like the button field to be the last column in the gridview.  When I just add a colum to the GV like:
  <Columns>    
                    <asp:ButtonField Text=" X " ButtonType="button" CommandName="deleteFromList" />
 </Columns>

And then create a datatable in code and bind it it puts the button field as the first column.

if I add bound fields that match the datatable before the buttonfield it prints the correct data in the bound fields but also adds the columns again as non bound fields.

For example I have:

<gridview>
<column>
    <boundField>
    <boundField>
    <buttonField>
</column>
</gridview>

The data that is displayed in the gridview is as follows
boundData  |  boundData  |  buttonField  |  Redundant Data Field | Redundant Data Field
0
Comment
Question by:mdrapiza
1 Comment
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34139338
Make sure you turn of "AutoGenerateColumns" if you are manually adding them as well.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question