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

Rad

5 Answers 126 Views
GridView
This is a migrated thread and some comments may be shown as answers.
subbu
Top achievements
Rank 1
subbu asked on 04 May 2011, 02:28 PM
Hi,

I am regular user of rad controls now in my project i want following options in radgrid.

1. I am not able to make textbox multiline  placed inside a grid cell(it should be cell wise as we have different controls in each grid cell) with scroll option. 
2. Can we have multiselect dropdown list in grid cell.

And i am dynamically loading controls in each grid cell @ runtime.

Please suggest me solutions for this.

5 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 06 May 2011, 08:03 AM
Hello,

There is an example in the project listed here on how to create custom cells, and actually a multi line textbox cell is used in that example.
For the multiselect dropdown list i would suggest a custom control that will handle all the logic needed.

Please take a look at the following KB article :Implementing checkbox items in RadComboBox (I know it is an old article, but it should put you on the right track)

After that you can use this KB Article: Adding custom elements inside a cell when it is in edit mode to achieve the desired behavior.
 
Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Sandesh
Top achievements
Rank 1
answered on 06 May 2011, 10:22 AM

Hi,


Thanks for your support,

I am looking something like this & also refer attachment for more details.

private
void rdGdv_Section_EditorRequired(object sender, EditorRequiredEventArgs e)

 

 

{

string ElementType=rdGdv_Section.CurrentRow.Cells[

"ElementType"].Value.ToString();

if(ElementType=="TextBox")
{
e.editor=new RadTextBoxEditor();
}
else if(ElementType=="MultiLineTextBox")
{
RadTextBoxEditor txt=new RadTextBoxEditor();
txt.Multiline=True;
e.editor=txt;
}
else if(ElementType=="DropdownList")
{

 

 

RadComboBoxEditor cmb

 

=new RadComboBoxEditor();
e.editor=cmb;
}

 

 

}

I the above code i am unable to add combobox & multiline text box to grid cell as editor controls.

0
Svett
Telerik team
answered on 10 May 2011, 08:54 AM
Hi Subbu,

You can customize editor properties when handling the CellEditorInitialized event which fires after the configuration of the editor. Please, consider the following code snippet:

private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    string elementType = Convert.ToString(this.radGridView1.CurrentRow.Cells["ElementType"].Value);
 
    if (elementType == "multitxt")
    {
        RadTextBoxEditor txt = e.ActiveEditor as RadTextBoxEditor;
        txt.Multiline = true;
    }
}
 
private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
    string elementType = Convert.ToString(this.radGridView1.CurrentRow.Cells["ElementType"].Value);
 
    if (elementType == "txt")
    {
        RadTextBoxEditor txt = new RadTextBoxEditor();
        e.Editor = txt;
    }
    else if (elementType == "multitxt")
    {
        RadTextBoxEditor txt = new RadTextBoxEditor();
        e.Editor = txt;
    }
}

Regarding the multi-selected drop down list, you can use the Emanuel's resource to create a custom editor.

Do not hesitate to contact us if you have any further questions.

Greetings,
Svett
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
0
Sandesh
Top achievements
Rank 1
answered on 10 May 2011, 10:51 AM
Hi,

Thank you for your support..

Can i have scroll bar for the same cell.
0
Svett
Telerik team
answered on 12 May 2011, 07:44 AM
Hi Sandesh,

You can show the scroll bars by setting the ScrollBars property to ScrollBars.Both:

private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    string elementType = Convert.ToString(this.radGridView1.CurrentRow.Cells["ElementType"].Value);
 
    if (elementType == "multitxt")
    {
        RadTextBoxEditor txt = e.ActiveEditor as RadTextBoxEditor;
        RadTextBoxEditorElement editorElement = txt.EditorElement as RadTextBoxEditorElement;
        editorElement.TextBoxItem.ScrollBars = ScrollBars.Both;
        txt.Multiline = true;
    }
}

I hope this helps.

Best wishes,
Svett
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
subbu
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Sandesh
Top achievements
Rank 1
Svett
Telerik team
Share this question
or