[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2010-11-15
1
Medium Priority
?
975 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 52

Accepted Solution

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

656 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