Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
620
CTP TemplateColumn
posted

I want to add a Button to each line in the grid (this is what I have now)

 

   <igGrid:XamWebGrid.Columns>
    <igGrid:TextColumn Key="TDescription" HeaderText="Description" IsReadOnly="True" HorizontalContentAlignment="Left"/>
    <igGrid:TextColumn Key="TReportDescription" HeaderText="Report Description" IsReadOnly="True" HorizontalContentAlignment="Left"/>
    <igGrid:TemplateColumn Key="LEnabled" HeaderText="Enabled" IsReadOnly="True" HorizontalContentAlignment="Center">
     <igGrid:TemplateColumn.ItemTemplate>
     <DataTemplate>
      <CheckBox IsChecked="{Binding LEnabled}"></CheckBox>
     </DataTemplate>
     </igGrid:TemplateColumn.ItemTemplate>
    </igGrid:TemplateColumn>
    <igGrid:TemplateColumn Key="Edit" HeaderText=" ">
     <igGrid:TemplateColumn.ItemTemplate>
      <DataTemplate>
       <Button Tag="{Binding}" Content="Edit" Width="Auto" Height="Auto" Click="Button_Click"></Button>
      </DataTemplate>
     </igGrid:TemplateColumn.ItemTemplate>
    </igGrid:TemplateColumn>    
   </igGrid:XamWebGrid.Columns>
  </igGrid:XamWebGrid>

I want to store the Rows data object in the Tag of the button so I can get the data in the click event. Is this possible as I keep getting the Error

The following key(s) do not correspond with the DataSource: "Edit". If you'd like to add additional columns, please use the TemplateColumn type.

The Edit key is not in the datasource its just a name I have to the TemplateColumn.

Help..

Thanks David.

 

Parents
No Data
Reply
  • 40030
    Offline posted

    Hi David, 

    So this is a breaking change we are introducing in 10.1.  We've added an Unbound column which should be used for custom templates such as this. And now a TemplateColumn is considered a "bound" column.  Meaning it must be associated with a property in your data model.  By doing this, we hope to eliminate confusion that some or our customers were running into, when want to have a bound column, but want to customize how the content looks.  Bound columns have the luxury of being able to be sorted, filtered, grouped by, etc.  While the unbound column should be used in situations where you have a calculated value not in your data model, or such things as a Button in a column. 

    Hope this helps clear things up. 

    -SteveZ

Children