I have a table with about 30 textboxes. Each row has 2 textboxes that have the same prefix but different suffix such as txtAvgFrom and txtAvgTo. I need to loop through the table and perform custom validation on the textboxes: 1- only integers 2- if both to and from textboxes are filled in I have to check that the value in from textbox is smaller than the from value. 3- range entered in each textbox is 1-100

I might need more validations later on. Also, if the to textbox is filled in then the from isn't required and vice versa. No textbox is required.

I need to do server side validation. Should i add customvalidation control? If yes, then for each textbox? Do I set controltovalidate? I need to display the correct error next to each row when submit button is clicked. And obviously if page is not valid then don't do anything further.

I am very confused. Appreciate the help. THANKS

The layout is something like this:

<table>
<tr>
<td> From price </td>
td><asp:textbox runat=server id=txtPriceFrom></td>
td>To price</td>
td><asp:textbox runat=server id=txtPriceTo></td>
<td> From yield</td>
td><asp:textbox runat=server id=txtYieldFrom></td>
td>To yield</td>
td><asp:textbox runat=server id=txtYieldTo></td>

Related posts

Recent Viewed