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

RadDropDownListEditor

3 Answers 341 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sinderela
Top achievements
Rank 1
Sinderela asked on 27 May 2012, 06:53 AM

 

 

Hi.
I used RadDropDownListEditor  in my gridview.when press tab Key and enter it,and start write with keyboard
i have a problem.but when enter this cell with Mouse I don't have any problem.
I used RadDropDownListEditor  in ver2011 and don't have any problem.
but now Use ver2012.this problem is exist.


private
void GrdCheck_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)

 

{

 

 

    if (GrdCheck.CurrentColumn is GridViewComboBoxColumn)

 

    {

 

 

        if (GrdCheck.CurrentColumn.Name.ToString() == "BankRef")

 

            {

 

 

            RadDropDownListEditor comboBoxEditor = this.GrdCheck.ActiveEditor as RadDropDownListEditor;

 

 

 

            if (comboBoxEditor != null)

 

            {

                comboBoxEditor.EditorElement.StretchVertically =

 

false;

 

                comboBoxEditor.DropDownStyle = Telerik.WinControls.

 

RadDropDownStyle.DropDownList;

 

                comboBoxEditor.DropDownSizingMode =

 

SizingMode.UpDownAndRightBottom;

 

            }
            }
    

 

}

 

}

 

 

 

private void GrdCheck_CellEditorInitialized(object sender, GridViewCellEventArgs e)

 

{

 

 

    if (GrdCheck.CurrentColumn.Name.ToString() == "BankRef")

 

    {

 

 

        RadDropDownListEditor cmb = GrdCheck.ActiveEditor as RadDropDownListEditor;

 

 

 

        if (cmb != null)

 

        {

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).DisplayMember = "Descr";

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).ValueMember = "Id";

 

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).DataSource =DtBankCheck;

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).SelectedIndex = -1;

 

            ((

 

RadDropDownListEditorElement)(cmb).EditorElement).ShowPopup();

 

        }

    }
}

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 30 May 2012, 03:42 PM
Hello Sinderela,

Could you please let me know what your exact issue with the Tab key approach is? Please describe the desired behavior and the behavior that you actually get in details. This will allow me to provide you with an adequate response.

Regards,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Sinderela
Top achievements
Rank 1
answered on 07 Jun 2012, 06:15 AM
Hello .
I'm sending an example.
please run it.
first type in Column 'Row' and press Enter key,then press tab key.
then write in Column 'Test'.
then error is happen.


 

using System;
using System.Collections.Generic;

using System.ComponentModel;  

using System.Data;  

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using  Telerik.WinControls;  

using Telerik.WinControls.UI;

 

namespace RadControlsWinFormsApp2  

 public partial class RadForm1 : Telerik.WinControls.UI.RadForm
 {
 public RadForm1()  

 {

  InitializeComponent();

 }

 private void RadForm1_Load(object sender, EventArgs e)

 {

  SetDt();

  SetGrid();

  SetDtGrid();

 }

 DataTable dt = new DataTable(); 
 private void SetDt()

 {

  dt.Columns.Add("Id", typeof(decimal));

  dt.Columns.Add("Name", typeof(string));

  for (int i = 0; i < 5; i++)

  {

  DataRow dr = dt.NewRow();

  dr[0] = i + 1;

  dr[1] ="Name" + (i + 1);

  dt.Rows.Add(dr);

  }

 }

 private void SetGrid()

 {

   radGridView1.AllowDeleteRow = false;

   radGridView1.AllowAddNewRow = false;

   radGridView1.TableElement.RowHeight = 25;

   radGridView1.TableElement.GroupHeaderHeight = 30;

   radGridView1.EnableSorting = false;

   radGridView1.EnableGrouping = false;

GridViewTextBoxColumn txt = new GridViewTextBoxColumn();

 

txt.FieldName = "Row";

 

txt.Name =  "Row";

 

txt.HeaderText = "Row";

 

txt.Width = 70;

radGridView1.Columns.Add(txt);

radGridView1.Columns["Row"].ReadOnly = false;

 

radGridView1.Columns["Row"].IsVisible = true;

GridViewComboBoxColumn cmb = new GridViewComboBoxColumn();

 

cmb.Name = "Test";

 

cmb.HeaderText = "Test";

 

cmb.DataSource = dt;

cmb.ValueMember = "Id";

 

cmb.DisplayMember = "Name";

 

cmb.FieldName = "Test";

 

cmb.Width = 100;

radGridView1.Columns.Add(cmb);

radGridView1.Columns["Test"].ReadOnly = false;

radGridView1.Columns["Test"].IsVisible = true;

cmb.DropDownStyle = RadDropDownStyle.DropDown;

cmb.AutoCompleteMode = AutoCompleteMode.Suggest;  

}

 

DataTable dtGrid = new DataTable();
private void SetDtGrid()

{

  dtGrid.Columns.Add("Row", typeof(decimal));

  dtGrid.Columns.Add("Test", typeof(string));

  DataRow dr = dtGrid.NewRow();

 

  dr[0] = "1";

  dr[1] = 2;

  dtGrid.Rows.Add(dr);

  radGridView1.DataSource = dtGrid;

}

bool flag;
private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)

{

  if (radGridView1.CurrentColumn is GridViewComboBoxColumn)

  {

    if (radGridView1.CurrentColumn.Name.ToString() == "BankRef")
     {
       if (!flag)

       {

         flag = true;

        RadDropDownListEditor cmb = new RadDropDownListEditor();
        ((RadDropDownListEditorElement)((RadDropDownListEditor)radGridView1.ActiveEditor).EditorElement)
        .ListElement.Font =
new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular); 

      }

    }

  }

}

private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)

{

  if (radGridView1.CurrentColumn.Name.ToString() == "Test")  

   {

     RadDropDownListEditor cmb = radGridView1.ActiveEditor as RadDropDownListEditor
     if (cmb != null)

    {
     ((RadDropDownListEditorElement)(cmb).EditorElement).DisplayMember = "Name";

 

     ((RadDropDownListEditorElement)(cmb).EditorElement).ValueMember = "Id";

 

     ((RadDropDownListEditorElement)(cmb).EditorElement).DataSource = dt;

 

     ((RadDropDownListEditorElement)(cmb).EditorElement).SelectedIndex = -1;

 

    ((RadDropDownListEditorElement)(cmb).EditorElement).ShowPopup();

 

    }

  }

}

}

}

0
Peter
Telerik team
answered on 08 Jun 2012, 02:20 PM
Hello Sinderela,

Thank you for the providing additional details

I managed to reproduce this issue and I logged it in our issue tracking system. We will try to address it in our next release. I updated also your Telerik points for bringing our attention to the issue.

As a workaround you should change this line:

cmb.AutoCompleteMode = AutoCompleteMode.Suggest;

with this:
cmb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

Do not hesitate to contact us if you have other questions.

Regards,

Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Sinderela
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Sinderela
Top achievements
Rank 1
Peter
Telerik team
Share this question
or