Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > dynamic datagrid and validator

Thread Tools

dynamic datagrid and validator

Posts: n/a

I have a problem with one datagrid and a CompareValidator :

I have a datagrid, filled with textbox, and a button. I expect integer
in my textbox, so I want to test data before to process with a
I build my dategrid in a function called in the Page.Load().
TemplateColumn textBoxColumn = new TemplateColumn();
textBoxColumn.HeaderText = "";

int j = 0;
foreach(DataGridItem dgi in MainDataGrid.Items)
// TextBox Warning
TextBox warningTextBox = new TextBox();
warningTextBox.ID = "warningTextBox"+j;
warningTextBox.Width = 50;
warningTextBox.EnableViewState = true;

// Validator
CompareValidator warningValidator = new CompareValidator();
warningValidator.ControlToValidate = warningTextBox.ID;
warningValidator.Operator = ValidationCompareOperator.DataTypeCheck;
warningValidator.Type = ValidationDataType.Integer;
warningValidator.Text = "error";
warningValidator.Display = ValidatorDisplay.Dynamic;
warningValidator.ID = "warningValidator"+j;

Next in the Button_Click(), I test data validity. But there is no
message and the function isValid always equals to true.

CompareValidator warningValidator =
if (warningValidator != null)
if (warningValidator.IsValid)
the next.....

If anyone have an idea ????
Bests regards
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts Validator - creditCard validator Java 4 02-13-2007 08:32 PM
dynamic drop downlists in an editable dynamic datagrid. ASP .Net Datagrid Control 0 06-22-2005 09:01 PM
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the datagrid Update event. Daniel Roth ASP .Net Datagrid Control 0 04-05-2005 03:58 AM
dynamic datagrid and validator aurelie ASP .Net Web Controls 0 05-10-2004 04:31 PM
dynamic datagrid and validator aurelie ASP .Net Building Controls 0 05-10-2004 04:31 PM