This is a migrated thread and some comments may be shown as answers.

[Solved] telerik:RadGridView , GridViewDataColumn and Check Box.........

1 Answer 295 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Saif
Top achievements
Rank 1
Saif asked on 24 Apr 2013, 11:26 PM
Hi All,
         I m running into an issue with a GridviewDataColumn and Check box template on the RadGridView.
I have two check boxes on the RadGridView as Check box  Datatemplate on GridviewDataColumn and i need to enable or disable the 2ns check box when the first one is checked ...and also i need to update the database with these two  boolean flags when i lose the focus of the row..... let me put some code now.... I also wanted to use RowEditEnded="rgvOtherLienDetailInsurance_rowendedit"  to update the database with these checkbox changes.
  
<telerik:RadGridView Visibility="Collapsed" x:Name="rgvOtherLienDetailInsurance"
           RowEditEnded="rgvOtherLienDetailInsurance_rowendedit" Margin="20,0,20,0" RowLoaded="rgvOtherInsurance_RowLoaded"        >.
<telerik:RadGridView.Columns>
 
<telerik:GridViewDataColumn Width="50"    EditTriggers="CellClick" HeaderTextAlignment="Center" DataMemberBinding="{Binding IsSweepLetterSent }" IsReadOnly="True">
                           <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                <CheckBox   IsChecked="{Binding IsSweepLetterSent}" Checked="sls_checked"   />
                  </DataTemplate>
         </telerik:GridViewDataColumn.CellTemplate>
        <telerik:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
    <CheckBox    IsChecked="{Binding IsSweepLetterSent, Mode=TwoWay,  UpdateSourceTrigger=PropertyChanged }" Checked="sls_checked" />
     </DataTemplate>
      </telerik:GridViewDataColumn.CellEditTemplate>
       <telerik:GridViewDataColumn.Header>
      <TextBlock Text="SS" ToolTipService.ToolTip="Sweeps Letter Sent" ToolTipService.Placement="Top" ></TextBlock>
       </telerik:GridViewDataColumn.Header>
        </telerik:GridViewDataColumn>
     <telerik:GridViewDataColumn Width="50"  EditTriggers="CellClick"  HeaderTextAlignment="Center" DataMemberBinding="{Binding IsSweepLetterReceived}" IsReadOnly="True">
               <telerik:GridViewDataColumn.CellTemplate>
                  <DataTemplate>
                   <CheckBox   IsChecked="{Binding IsSweepLetterReceived, Mode=TwoWay}" Checked="slr_checked"   />
                               </DataTemplate>
                  </telerik:GridViewDataColumn.CellTemplate>
                  <telerik:GridViewDataColumn.CellEditTemplate>
                    <DataTemplate>
             <CheckBox    IsChecked="{Binding IsSweepLetterReceived, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Click="slr_checked" />
                </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
                  <telerik:GridViewDataColumn.Header>
              <TextBlock Text="SR" ToolTipService.ToolTip="Sweeps Letter Received" ToolTipService.Placement="Top" ></TextBlock>
             </telerik:GridViewDataColumn.Header>
              </telerik:GridViewDataColumn>
            <telerik:GridViewCheckBoxColumn Width="60" AutoSelectOnEdit="True" EditTriggers="CellClick"  HeaderTextAlignment="Center" DataMemberBinding="{Binding  IsConditionalDemandLetterSent}" IsReadOnly="False">
          <telerik:GridViewCheckBoxColumn.Header>
                <TextBlock Text="C1S" ToolTipService.ToolTip="Conditional Demand Letter Sent" ToolTipService.Placement="Top" ></TextBlock>
               </telerik:GridViewCheckBoxColumn.Header>
                 </telerik:GridViewCheckBoxColumn>
and also i have checkedchanged events to toggle the checkboxes....... adding the code for that
private void sls_checked(object sender, RoutedEventArgs e)
  {
      var parent = (sender as CheckBox).ParentOfType<GridViewRow>();
      if (parent.Cells[6].Column.UniqueName == "IsSweepLetterSent")
      {
 
          ((CheckBox)parent.Cells[6].Content).Unchecked+=new RoutedEventHandler(CheckboxUnchecked);
          ((CheckBox)parent.Cells[6].Content).Checked+=new RoutedEventHandler(CheckboxChecked);
          
      }
  }
But now how do i call the rROWENDEDIT  EVENT TO SAVE THE DATA......(object sender, GridViewRowEditEndedEventArgs e)

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 26 Apr 2013, 10:02 PM
Hello Saif,

 
You can try working with IsReadOnlyBinding and use the property from the first column for the second one through this binding. Check out this article for more information.  Considering RowEditEnded event, it will be fired once the row loses the focus. If you want to commit the changes, you can call the corresponding method of RadGridView - CommitEdit() (or CancelEdit() if appropriate).

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Saif
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or