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

[Solved] Edit cell content in gridview for Silverlight Q2 2009

12 Answers 214 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.
NickZ
Top achievements
Rank 1
NickZ asked on 01 Oct 2009, 04:06 PM
Hello,

I am working on a project using RadControls GridView.  I have a case that cell content in a gridview is editable and will be saved.  This edit function worked fine with RadControls for Silverlight Q1 2009.  But when we bought RadControls for Silverlight Q2 2009, editing cell content becomes an issue. 

In my case, this gridview has two column, Column#1 is item name and Column#2 is item value (string/number).  Col#1 was set as ReadOnly.  There are 5 rows and I double-clicked on cell and change the content, and did one by one for Col#2.  Every time after I left edited cell, the changed (new) value stay the cell.  But for the new Q2 version, when I left edited cell, the new value disappered and switched back to the previous value immediately.  The idea in my code is that after content's change, I will read this gridview and update in DB.  Did I do anything wrong or there is a bug in your code?

Thanks a lot,
Nick

12 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 02 Oct 2009, 05:44 AM
Hi Nick,

Can you provide a bit more info about how the grid is bound in your case? More info about your collection of business objects will be appreciated!

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
NickZ
Top achievements
Rank 1
answered on 05 Oct 2009, 09:44 PM
Hi Vlad,  thanks for your reply.

 

In my case, I got data out of database using webservice. Data are shown in RadGridView and one column is editible. With Q1 version, I can change each cell and at the end I can read the whole page to get each cell's value.  here is the code I used to read the grid:

            var rows_a = ResultPopUpAttributeGrid.ChildrenOfType<GridViewRow>();  
            List<string> nzlist_a = new List<string>();  
            for (int i = 1; i < rows_a.Count; i++)  
            {  
                //MessageBox.Show(rows_a[i].Cells[0].Content.ToString() + "+++" + rows_a[i].Cells[1].Content.ToString());  
                if (rows_a[i].Cells[1].Content.ToString() != "")  
                    nzlist_a.Add(rows_a[i].Cells[0].Content.ToString() + "," + rows_a[i].Cells[1].Content.ToString());  
            }  
 

Then I used webservice to put data back to database. But with Q2 version, every cell content won't stay after change. 

Thanks again.
Nick

0
Vlad
Telerik team
answered on 09 Oct 2009, 05:59 AM
Hello Nick,

Can you send small running example where we can reproduce and debug the grid behavior in your case? In general I suggest you to use Items property of the grid to loop over your business objects instead UI elements.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
NickZ
Top achievements
Rank 1
answered on 09 Oct 2009, 09:54 PM
Hi Vlad,

Thanks for your reply.  Here is a sample project.

MainPage.xaml
<UserControl x:Class="SLTelerikGridViewTest.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
    xmlns:data="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" > 
    <Grid x:Name="LayoutRoot" Background="AliceBlue">  
        <Grid.RowDefinitions> 
            <RowDefinition Height="100" /> 
            <RowDefinition Height="*" /> 
            <RowDefinition Height="100" /> 
        </Grid.RowDefinitions> 
        <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="100" /> 
            <ColumnDefinition Width="*" /> 
            <ColumnDefinition Width="100" /> 
        </Grid.ColumnDefinitions> 
 
        <data:RadGridView x:Name="AttributePopUpDataGrid" ShowGroupPanel="false"   
                                Grid.Row="1" Grid.Column="1"   
                                AutoGenerateColumns="False">  
        </data:RadGridView> 
 
    </Grid> 
</UserControl> 

MainPage.xaml.cs

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Net;  
using System.Windows;  
using System.Windows.Controls;  
using System.Windows.Documents;  
using System.Windows.Input;  
using System.Windows.Media;  
using System.Windows.Media.Animation;  
using System.Windows.Shapes;  
using Telerik.Windows.Controls;  
using System.Windows.Data;  
 
namespace SLTelerikGridViewTest  
{  
 
    public class simuAttributes  
    {  
        public string Attribute { get; set; }  
        public string Change { get; set; }  
    }  
 
    public partial class MainPage : UserControl  
    {  
        public MainPage()  
        {  
            InitializeComponent();  
            Loaded += new RoutedEventHandler(Page_Loaded);  
        }  
 
        void Page_Loaded(object sender, RoutedEventArgs e)  
        {  
            AttributePopUpDataGrid.Columns.Clear();  
 
            GridViewDataColumn column = new GridViewDataColumn();  
            column.HeaderText = "ATTRIBUTE";  
            column.UniqueName = "Attribute";  
            column.HeaderTextAlignment = TextAlignment.Center;  
            column.DataMemberBinding = new Binding("Attribute");  
            column.Width = new GridLength(1, GridUnitType.Star);  
            column.IsFilterable = false;  
            column.IsReadOnly = true;  
            this.AttributePopUpDataGrid.Columns.Add(column);  
 
            column = new GridViewDataColumn();  
            column.HeaderText = "CHANGE";  
            column.UniqueName = "Change";  
            column.HeaderTextAlignment = TextAlignment.Center;  
            column.DataMemberBinding = new Binding("Change");  
            column.Width = new GridLength(1, GridUnitType.Star);  
            column.IsFilterable = false;  
            this.AttributePopUpDataGrid.Columns.Add(column);  
 
            //simuAttributes temp = new simuAttributes();  
 
            List<simuAttributes> temp = new List<simuAttributes>();  
 
            temp.Add(new simuAttributes() { Attribute = "Attr1"Change = "" });  
            temp.Add(new simuAttributes() { Attribute = "Attr2"Change = "" });  
            temp.Add(new simuAttributes() { Attribute = "Attr3"Change = "" });  
            temp.Add(new simuAttributes() { Attribute = "Attr4"Change = "" });  
            temp.Add(new simuAttributes() { Attribute = "Attr5"Change = "" });  
 
            AttributePopUpDataGrid.ItemsSource = temp;  
        }  
    }  
}  
 

I used two versions of RadControls (Silverlight Q1 2009 and Silverlight Q2 2009).  The only difference is that HeaderText in Q1 is Header in Q2.  When you run, there will be a two-columns grid, first column (ATTRIBUTE) is read only and second one (CHANGE) is editable.  For Q1 version, edited cell value stays after moving to another cell.  But in Q2, edited cell value disappeared after moving to another cell.  

Do you have any sample code for using Items property of the grid? 

Thanks,
Nick
0
Nedyalko Nikolov
Telerik team
answered on 13 Oct 2009, 12:01 PM
Hi NickZ,

There was a bug in our Q2 release related to IsReadOnly property, but it is fixed with the latest internal build.
Please let me know if there are further issues.

Greetings,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gregg
Top achievements
Rank 1
answered on 13 Oct 2009, 01:31 PM
Hi Nedyalko,

1. Where can I get the lasted fixed internal build?  I got the latest one from http://www.telerik.com/account/free-trials.aspx, and the bug still exists.
2. For trial version, after I deploy the project, there is a blue screen saying this is a trial version, for a few second.  Is the latest fixed build what we will download is a trial version?  If it is, how can I remove that blue screen, since we purchased the license. 

Thanks,
NIck
0
Hristo
Telerik team
answered on 13 Oct 2009, 03:42 PM
Hi Nick,

To download the latest internal build please log in to our site, under the account you have purchased the license, and go to Your Account->Downloads->Latest Internal Builds->RadControls_for_Silverlight_2009_2_1009_Dev.zip. You can also follow this link after log in.

To get rid of the trial message, you need to download the latest official DEV version of our Silverlight controls (Q2 2009) and replace the TRIAL DLLs with the DEV ones.

Greetings,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
NickZ
Top achievements
Rank 1
answered on 13 Oct 2009, 04:07 PM
Hello,  Vlad/Nedyalko/Hristo,

I downloaded the latest internal build and it didn't fix the problem (RadControls_for_Silverlight_2009_2_1009_Dev.zip).  I tested it using the sample project I sent you.  Could you please test it with the latest internal build and send me the dlls or msi which works correctly?

Thanks,
Nick
0
NickZ
Top achievements
Rank 1
answered on 15 Oct 2009, 01:15 PM
Hello,

Can anyone help me here?  It has been more than 2 weeks since I first posted this issue.  My client is wondering why I can't solve the problem in such a long time. 

Thanks,
Nick
0
Missing User
answered on 15 Oct 2009, 02:38 PM
Hello NickZ,

  First of all, please accept my apologies for the late answer.
 Unfortunately you are right about the problem persisting in our latest internal build.
   I've tried your sample application with the dlls from our second Q3 beta which we are about to release and the good news are that everything was working fine on my end.
 Our second beta for the 2009.Q3 release will be online in a few hours, and the official release is expected in early November.
 Once the beta is released ,please give it a try  and let us know how it goes.

Regards,
Anastasia
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
NickZ
Top achievements
Rank 1
answered on 19 Oct 2009, 02:32 AM
Hi Anastasia,

I tried 10/16 build and I didn't see that bug anymore.  Thanks a lot for your help.  I have a couple of questions regarding this build.

1. In the sample project I gave, there is a compile error for line of code:
column.Width = new GridLength(1, GridUnitType.Star);  
The message is that Cannot implicitly convert type 'System.Windows.GridLength' to 'Telerik.Windows.Controls.GridViewLength'.  How can I fix this error?

2. Since this is a trial version, I will see a blue screen for a few seconds when I put it in production.  Since we purchased the full year license, is there a way I can remove this blue screen so client won't see it?

Thanks again,
Nick
0
Hristo
Telerik team
answered on 19 Oct 2009, 09:09 AM
Hello NickZ,

Straight onto your questions:

1. You simply need to replace that line of code:

column.Width = new GridLength(1, GridUnitType.Star);

with :

column.Width = new GridViewLength(1, GridViewLengthUnitType.Star);

2.  To get rid of the trial message, you need to download the latest official DEV version of our Silverlight controls (Q2 2009) and replace the TRIAL DLLs with the DEV ones.

Regards,

Hristo
the Telerik team

 


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
NickZ
Top achievements
Rank 1
Answers by
Vlad
Telerik team
NickZ
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Gregg
Top achievements
Rank 1
Hristo
Telerik team
Missing User
Share this question
or