views:

521

answers:

1

Hi, Is it possible to specify a size for the grid view cell when it is in edit mode. The size should be in terms of letters (like we have maximum size for a text box) and not in pixels. My requirement is that user should be able to input not more than 100 characters in the cell when he is editing it.

I want to avoid validating after the user updates as it will get inconsistent with the rest of the site.

Any other work-around is much appreciated.

Any inputs???

Thanks :)

A: 

You probably need to use TemplateFields and define EditItemTemplate where you set the maximum length of textbox. Or you could use validation and give error if the input is too big.

Kuytu
Will it be possible to give some sample code? Also can I still use a Template column if I am binding a dataset directly to my data grid?
Rashmi Pandit
I just noticed you were talking about winforms instead of webforms. My bad. I don't know much about winforms, but I quickly created a project with gridview connected to database. It seems that the columns have a MaxInputLength-property. You can set it programmatically or from the visual editor choosing Edit Columns on the gridview.
Kuytu