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

Ask for function in GridView

3 Answers 112 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 12 Jan 2011, 03:51 PM

Ask for function in GridView (cell, combobox):
1.I have two decimal columns A and B. I write into A 55 and next click in column B i click small up buttton and I have value 56 but i want to get 1. How can I disabled remember function for this two columns?
2.I have ComboboxColumn in Grid with properties: DropDownStyle-DropDown and AutoCOmpleteMode-SuggestAppend. Can I in this controls reduce items in combobox during edit? f.e I write Ma and in comboboxe user see only items begins word Ma?
full            Only Ma
M              Ma      
Marcin       Marcin
Maciej        Maciej
Marta         Marta
Monika

Thanks for help.

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 12 Jan 2011, 04:03 PM
Hello,

On your first requirement, please can you expand..from what I understand you would like the spin editor to always be 1 when editing a numeric value. Is that correct?
On your second question, please find the answer in this forum answer from Svett

Regards,
Richard
0
Emanuel Varga
Top achievements
Rank 1
answered on 13 Jan 2011, 10:21 AM
Hello Marcin, Richard,

Please try handling the CellEditorInitialized event, and if the cell value is null just set the value of the editorElement to 0.

void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    if (e.ActiveEditor is GridSpinEditor)
    {
        var editor = e.ActiveEditor as GridSpinEditor;
        var editorElement = editor.EditorElement as GridSpinEditorElement;
        editorElement.Value = e.Value != null ? decimal.Parse(e.Value.ToString()) : 0;
    }
}

It is not remembering, but the grid is reusing elements, and because that cell does not have a value, the old value remains in the editor element.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Stefan
Telerik team
answered on 14 Jan 2011, 05:03 PM
Hi Marcin,

Your question has already been answered in the other thread you have opened. Please see our answer there for more information.
 
Best wishes,
Stefan
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Marcin
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Emanuel Varga
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or