Mapping <TemplateColumns> in a DataGrid

Results 1 to 2 of 2

Thread: Mapping <TemplateColumns> in a DataGrid

  1. #1
    Join Date
    Dec 1969

    Default Mapping <TemplateColumns> in a DataGrid

    Apologies if the question has been asked before, but could someone point me in the general direction of doing this?<BR><BR>I have a query that returns an ADO.Net DataTable. Right now if I bind it to my DataGrid the table&#039;s columns are automatically mapped and written displayed in the grid, column for column.<BR><BR>That&#039;s fine, but what I&#039;d really like to do is take 5 or 6 columns from this DataTable and bind them to various &#060;TemplateColumns&#062; I&#039;ve established in the DataGrid; specifically, a TextBox and five or six CheckBoxes. <BR><BR>I don&#039;t want every column from the DataTable to be displayed in other words, just those five or six, and in an appropriate manner. For instance, I&#039;d like the checkboxes to be selected depending if the mapped DataTable column flag (a bit field) is set. Can anyone point me in a good direction for doing this? I&#039;m reading the 4guys&#039; series on DataGrids but nothing&#039;s jumped out at me on how to tackle this...thanks a bunch

  2. #2
    Join Date
    Dec 1969

    Default RE: Mapping <TemplateColumns> in a DataG

    Sure...In the DataGrid tag you can set the AutoGenerateColumns property to false, and then you specify what columns you want, by declaratively creating template columns, or bound columns for instance. Those, then, are the only columns that will appear in your DataGrid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts