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

[Solved] Uneditable gridview but need to insert.

5 Answers 89 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.
Keith Stephens
Top achievements
Rank 1
Keith Stephens asked on 12 Oct 2010, 09:00 PM
I have a page where a user logs in and creates generic notes
My class consists of NoteNum, NoteTitle, NoteBody.

I have another page that has a gridview with shipping rates, each rate has a child gridview that shows the generic notes that is tied to the rate selected.  This is coming back from a table that I have added entries to to get these notes back, for the rate selected.
The user should not be able to edit any of the fields, but the user needs to be able to add a new note from all notes avaliable to this rate.

Hope this makes sense.  Is this posible?
Thanks,
KS

Here is my child gridview; I think I also have something wrong with my binding to AllRateNotes.
<telerikGridView:RadGridView x:Name="childGrid2" Grid.Row="1" ItemsSource="{Binding Notes}"
                                        DataLoadMode="Synchronous"
                                         Deleting="childGrid2_Deleting"
                                                         Deleted="childGrid2_Deleted"
                                                         CanUserInsertRows="True"
                                                         CanUserSelect="True"
                                                         ShowInsertRow="True"
                                                           
                            CanUserDeleteRows="True"
                                        ShowGroupPanel="False"                  
                            IsSynchronizedWithCurrentItem="True"                            
                              
                                         AutoGenerateColumns="False">
                                <telerikGridView:RadGridView.Columns>
                                    <!--<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding AgentNotes, Mode=TwoWay}" Header="Rate Notes" />-->
                                    <telerikGridView:GridViewDataColumn  >
                                        <telerikGridView:GridViewDataColumn.Header>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock TextWrapping="Wrap" Text="Note Num" HorizontalAlignment="Center" />
                                            </StackPanel>
                                        </telerikGridView:GridViewDataColumn.Header>
                                        <telerikGridView:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding NoteNum, Mode=OneWay}" />
                                            </DataTemplate>
                                        </telerikGridView:GridViewDataColumn.CellTemplate>
                                    </telerikGridView:GridViewDataColumn> <!-- Note Num-->
                                    <telerikGridView:GridViewDataColumn  >
                                        <telerikGridView:GridViewDataColumn.Header>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock TextWrapping="Wrap" Text="Security Level" HorizontalAlignment="Center" />
                                            </StackPanel>
                                        </telerikGridView:GridViewDataColumn.Header>
                                        <telerikGridView:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding SecLevel, Mode=OneWay}" />
                                            </DataTemplate>
                                        </telerikGridView:GridViewDataColumn.CellTemplate>
                                        <telerikGridView:GridViewDataColumn.CellEditTemplate>
                                            <DataTemplate>
                                                <telerikInput:RadComboBox x:Name="cboSecLevel"
                                                                          ItemsSource="{Binding AllRateNotes, Mode=TwoWay}"
                                                                          IsEditable="False"
                                                                          IsReadOnly="True"
                                                        SelectedValuePath="NoteLevel"
                                                                          DisplayMemberPath="SecLevel">
                                                    <!--<telerikInput:RadComboBoxItem Content="Ext"  />
                                                    <telerikInput:RadComboBoxItem Content="Int" />-->
                                                      
                                                </telerikInput:RadComboBox>
                                            </DataTemplate>
                                        </telerikGridView:GridViewDataColumn.CellEditTemplate>
                                    </telerikGridView:GridViewDataColumn> <!-- Sec Level-->
                                    <telerikGridView:GridViewDataColumn  >
                                        <telerikGridView:GridViewDataColumn.Header>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock TextWrapping="Wrap" Text="Note Class" HorizontalAlignment="Center" />
                                            </StackPanel>
                                        </telerikGridView:GridViewDataColumn.Header>
                                        <telerikGridView:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding NoteClass, Mode=OneWay}" />
                                            </DataTemplate>
                                        </telerikGridView:GridViewDataColumn.CellTemplate>
                                    </telerikGridView:GridViewDataColumn> <!-- Note Class-->
                                    <telerikGridView:GridViewDataColumn  >
                                        <telerikGridView:GridViewDataColumn.Header>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock TextWrapping="Wrap" Text="Note Title" HorizontalAlignment="Center" />
                                            </StackPanel>
                                        </telerikGridView:GridViewDataColumn.Header>
                                        <telerikGridView:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Title, Mode=OneWay}" />
                                            </DataTemplate>
                                        </telerikGridView:GridViewDataColumn.CellTemplate>
                                    </telerikGridView:GridViewDataColumn> <!-- Note Title-->                                  
                                    <telerikGridView:GridViewDataColumn  >
                                        <telerikGridView:GridViewDataColumn.Header>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock TextWrapping="Wrap" Text="Rate Notes" HorizontalAlignment="Center" />
                                                  
                                            </StackPanel>
                                        </telerikGridView:GridViewDataColumn.Header>
                                        <telerikGridView:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding NoteBodyLines2, Mode=OneWay}" />
                                            </DataTemplate>
                                        </telerikGridView:GridViewDataColumn.CellTemplate>
                                        <telerikGridView:GridViewDataColumn.CellEditTemplate>
                                            <DataTemplate>
                                                <TextBox x:Name="txtAgtNotes" 
                                         Text="{Binding NoteBodyLines2, Mode=OneWay}" IsReadOnly="True"
                                                         TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True"/>
                                            </DataTemplate>
                                        </telerikGridView:GridViewDataColumn.CellEditTemplate>
                                    </telerikGridView:GridViewDataColumn> <!-- Note-->
                                     
                                </telerikGridView:RadGridView.Columns>
                                 
                            </telerikGridView:RadGridView>


5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 13 Oct 2010, 07:18 AM
Hi Keith Stephens,

In case it is appropriate for your specific scenario, you may set the IsReadOnly property of the parent grid to "True". Thus you will be able to add items and edit them in the child grid, but the parent will remain read-only.
 

Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Keith Stephens
Top achievements
Rank 1
answered on 13 Oct 2010, 03:44 PM
Not exacly what I was wanting.  Here is a screen shot of my page.

You will see inside the parent gridview I have 2 more child gridviews.  The second child with the headers NoteNum, Security Level ect..  I need this gridview to be readonly but I do need them to be able to add a note.

These notes are general existing notes in my database and I am just wanting to tie a note to this rate.

Thanks,
KS
0
Keith Stephens
Top achievements
Rank 1
answered on 13 Oct 2010, 03:47 PM
0
Keith Stephens
Top achievements
Rank 1
answered on 13 Oct 2010, 04:01 PM
I think I solved it.  Make the gridview editable, but if the action is edit then cancel it.
0
Maya
Telerik team
answered on 14 Oct 2010, 12:27 PM
Hi Keith Stephens,

Indeed, in case it meets your requirements, it will be an appropriate approach. Furthermore, you may handle the BeginningEdit event and cancel it for those grids you want. 
 

Sincerely yours,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Keith Stephens
Top achievements
Rank 1
Answers by
Maya
Telerik team
Keith Stephens
Top achievements
Rank 1
Share this question
or