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

How to mask input in a GridView with custom cell formatting

2 Answers 543 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 14 Apr 2009, 01:21 PM
I've got an interesting situation that I'm having a bit of trouble with and I was hoping someone could help me out.

I'm using a GridView to display a Key->Value pair, where the data type can vary between Integers, Strings, Currency, and DateTime.

I am catching the CellFormatting event in GridView and am able to properly draw the controls for each data type without much trouble, but I need a way to stop text from being typed into certain cells...

I know it can be done with a GridViewMaskBoxColumn, but as I've said - I have many different types of data, so that doesn't apply here.

My first intention was to use a RadSpinElement, which seemed to work at first, however when the data changes and it redraws itself, the text/number area of the element moves about 5 pixels to the left and is very annoying.  I've tried setting several layout and sizing options for the element, but can't seem to get it to draw correctly..

My second choice was to use a Masked Text Box element, but apparently the Masking feature that I need is in the Control, and not the element, so that won't work either..

Does anyone have any suggestions?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 14 Apr 2009, 01:44 PM
I've tracked my problem further down, but I'm still unable to resolve the issue..

It appears the the first row where I draw a custom element has a sizing issue, no matter what type of element I put inside it.

Here is what happens:

1)I create a grid with a 3 columns (GridViewTextBoxColumn:String, GridViewDataColumn:Object, GridViewTextBoxColum:Int32(hidden))
2)I Bind it to a BindingList in a custom class to pull the data from.


When I view the grid, you can see that the first row's custom element is wider than the rows beneath it.  After the first re-bind, the grid resizes the column and all of the custom elements to the proper size.  It makes all of them roughly 5 pixels wider, however, since the first row is already wider than it should be, it appears much out of place.
0
Julian Benkov
Telerik team
answered on 17 Apr 2009, 12:13 PM
Hello Demorrow,

Please send us a sample project of this scenario for RadGridView so that we can debug it locally. Thank you in advance.

Kind regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Brad
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or