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

gridview edit clears the cell

6 Answers 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jake
Top achievements
Rank 1
jake asked on 18 Oct 2010, 08:22 PM
I have a fairly simple radgridview I'm messing around with.  the data is loaded from a dataset, I only have 1 column that is editable (all others are readonly).  However, when I edit that column it clears the cell rather than letting me edit the value it is currently.

the code:


<telerik:RadGridView HorizontalAlignment="Left" Margin="12,78,0,0" 
                             Name="gvAccounts" VerticalAlignment="Top" Height="240" Width="619" 
                             AutoGenerateColumns="False" Grid.Column="0" CanUserSortColumns="False" 
                             DataLoaded="gvAccounts_DataLoaded" LoadingRowDetails="gvAccounts_LoadingRowDetails" 
                             CanUserReorderColumns="False" ShowGroupPanel="False" EditTriggers="CellClick" 
                             BeginningEdit="gvAccounts_BeginningEdit">
            <telerik:RadGridView.Columns>
                <telerik:GridViewSelectColumn />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding acct_num}"
                                       Header="Account No" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding reg_phone_num, Mode=TwoWay}"
                                       Header="Mobile Phone No" IsReadOnly="True">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding nickname, Mode=TwoWay}"
                                       Header="Nickname">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding created_dt, Mode=TwoWay}"
                                       Header="Date Activated" IsReadOnly="True">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding address, Mode=TwoWay}"
                                       Header="Service Address" IsReadOnly="True" TextWrapping="Wrap">
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 19 Oct 2010, 08:58 AM
Hello jake,

Unfortunately, I was not able to reproduce the issue you specified. I am sending you the sample project I used for testing it. Please feel free to change it in the way you want and share more details if there is some misunderstandings according to your requirements.
 

Best wishes,
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
jake
Top achievements
Rank 1
answered on 19 Oct 2010, 05:37 PM
the sample app works, I even tried adding a 'fresh' radgridview to see if I somehow messed up a property of the old one and it does the same thing (all fields are editable)

If it matters, this is in a WPF Custom Control library that is in a WPF Browser app.
0
jake
Top achievements
Rank 1
answered on 20 Oct 2010, 03:03 PM
I have even tried using your example as a starting point but I always end up with the same problem.  I am loading the gridview with a DataSet I am retrieving from a web service, would this be an issue?  Here is the only code-behind:

ctiwssms.SMSServiceSoapClient ws = new ctiwssms.SMSServiceSoapClient();
DataSet ds = new DataSet();
ds = ws.GetAccountsByCustomerNum("1186131997");
playersGrid.ItemsSource = ds;
0
Maya
Telerik team
answered on 20 Oct 2010, 04:02 PM
Hi jake,

It would be great if you could send us a sample project (via support ticket) or rearrange the one attached previously and send it back to me. In that way, after examining your exact requirements and settings, I will be able to provide you with an appropriate solution.
 

Best wishes,
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
jake
Top achievements
Rank 1
answered on 20 Oct 2010, 05:20 PM

I only changed 2 things in your sample:

in the MainWindow.xaml I changed the GridView to use the column names that will be coming back in the dataset:

<telerik:RadGridView Name="playersGrid"                             
                             CanUserReorderColumns="False" 
                             ShowGroupPanel="False" EditTriggers="CellClick" 
                             AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewSelectColumn />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding acct_num, Mode=TwoWay}" IsReadOnly="True"  TextWrapping="Wrap"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding reg_phone_num, Mode=TwoWay}" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding nickname, Mode=TwoWay}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding created_dt, Mode=TwoWay}" IsReadOnly="True"/>
              
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

then in the MainWindow.xaml.cs I added the code in the MainWindow() constructor to populate the data:

public MainWindow()
{
    InitializeComponent();
    ctiwssms.SMSServiceSoapClient ws = new ctiwssms.SMSServiceSoapClient();
    DataSet ds = new DataSet();
    ds = ws.GetAccountsByCustomerNum("1186131997");
    playersGrid.ItemsSource = ds;
    // Uncomment to enable Hierarchy
    //this.clubsGrid.TableDefinition.ChildTableDefinitions.Add(
    //    new GridViewTableDefinition
    //    {
    //        Relation = new PropertyRelation("Players")
    //    });
}

It doesn't seem like this control will work for me, I may just have to use a pure web app to get my GridView features. 

0
jake
Top achievements
Rank 1
answered on 22 Oct 2010, 03:18 PM
Well figured this out on my own.  For anyone else having this problem, I created a DataView and initialized it with the DataTable coming from my WebService call and simply used the DataView for the GridView's itemsource. 
Tags
GridView
Asked by
jake
Top achievements
Rank 1
Answers by
Maya
Telerik team
jake
Top achievements
Rank 1
Share this question
or