milicica

Is there any way to tie-down input in DataGridView column according to type values which that column represent. For example type column1 is numeric, column2 is alphanumeric, column3 is date, etc. How allow entry legal values and forbid entry illegal values to cells of DataGridView
Thanks in advance for any help with this question.



Re: Windows Forms Data Controls and Databinding Column Types in the DataGridView Control

Ross Dargan

You can do a lot of this with Microsofts Ajax control toolkit (the filter textbox - http://ajax.asp.net/ajaxtoolkit/FilteredTextBox/FilteredTextBox.aspx) but unfortunatly you have to turn all of your columns into template columns, and add the code manualy in order to do this.

The control one would have to be validate with a compare validator and you could use an ajax calandar control http://ajax.asp.net/ajaxtoolkit/Calendar/Calendar.aspx which I really like:)

Actually adding the ajax is easy - http://asp.net has loads of example, and the community is really helpfull! Let me know if you would like some examples and I will add them to my blog

Hope this helps a little

Ross (http://blog.the-dargans.co.uk)






Re: Windows Forms Data Controls and Databinding Column Types in the DataGridView Control

Oliver Lundt - LN

Yep, just use cell validating event. Also the cell parsing event can be useful to mesage data into an acceptable format for your data.

I believe cell formating is called befor cell validating event.




Re: Windows Forms Data Controls and Databinding Column Types in the DataGridView Control

Oliver Lundt - LN

Ross Dargan's response assumes you are talking about web "GridView"
System.Web.UI.WebControls.GridView

My response assumes you are talking about windows form's "DataGridView"
System.Windows.Forms.DataGridView





Re: Windows Forms Data Controls and Databinding Column Types in the DataGridView Control

Ross Dargan

Oops, you are right - they named them far too simmarly.

Ajax isnt going to be much use to you in windows;)