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

RadGridView and RadDataEntry

3 Answers 206 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jesse
Top achievements
Rank 1
Jesse asked on 14 Aug 2014, 11:42 AM
Greetings! I'm trying to make RadDataEntry window appear on current row double click, but there's no proper column captions appeared, and also a lot of needless information (image attached).

Here is my code:
GridView window

        private void dictionaryRecordsGrid_CellDoubleClick(object sender, GridViewCellEventArgs e)
        {
            GridViewRowInfo row = dictionaryRecordsGrid.CurrentRow;
            string dictionaryId = row.Cells["ID"].Value.ToString();
            TestNewForm f = new TestNewForm(_records.Select("id=" + dictionaryId).Single());
            f.ShowDialog();
        }

And RadDataEntry window:

        public TestNewForm(DataRow row)
        {
            InitializeComponent();

            radDataEntry1.DataSource = row;
            radDataEntry1.BindingCreated += radDataEntry1_BindingCreated;
        }










3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 18 Aug 2014, 01:23 PM
Hello Jesse,

Thank you for writing. 

In this case you can use the row's DataBoundItem and pass it to the form. This item is of type DataRowView and contains the actual row data: 
void radGridView1_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
    DataRowView row = ((DataRowView)e.Row.DataBoundItem);
    Form2 frm = new Form2(row);
   
    frm.ShowDialog();
}
// second form code
public partial class Form2 : Form
{
    public Form2(DataRowView view)
    {
        InitializeComponent();        
        radDataEntry1.DataSource = view;
    }
}

Let me know if you have additional questions.
 
Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Jesse
Top achievements
Rank 1
answered on 22 Aug 2014, 08:20 AM
Thank you, it works now!
But, encountered another problem. I've a byte[], and when i'm trying to parse binded value, e.Binding.Parse even not firing.

 private void radDataEntry1_EditorInitializing(object sender, Telerik.WinControls.UI.EditorInitializingEventArgs e)
        {
            if (e.Property.Name == "Icon")
            {
                ImageControl p = new ImageControl();
                p.BorderStyle = BorderStyle.FixedSingle;
                e.Editor = p;
            }
        }

        private void radDataEntry1_BindingCreated(object sender, Telerik.WinControls.UI.BindingCreatedEventArgs e)
        {
            if (e.DataMember == "Icon")
            {
                e.Binding.Parse +=Binding_Parse;
            }
        }

        private void Binding_Parse(object sender, ConvertEventArgs e)
        {
            byte[] arr = (byte[])e.Value;
            e.Value = arr;
        }
0
Dimitar
Telerik team
answered on 22 Aug 2014, 02:22 PM
Hello Jesse,

Thank you for writing back.

In this case you should use the Format event and convert the byte array to image. We have a detailed example for this (with code in VB and C#). Just start our demo application and navigate to DataEntry -> First Look. 

Do not hesitate to contact us if you have other questions.
 
Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Jesse
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Jesse
Top achievements
Rank 1
Share this question
or