c# - Range validator inside repeater -
i have repeater displays key-value pairs database table. of fields in table have min/max restriction. how can add range validator repeater , able use different ranges different fields?
for example, table fields are:
idle time: 20 (min 10, max 40)
pickup time: 60 (min 3, max 90)
when page displayed shows "idle time" (a label) , 20 in text box, nest row "pickup time" (a label) , 60 in textbox. need prevent user entering 80 or 5 in idle time, 80 or 5 valid pcikup time.
<itemtemplate> <tr> <td style="vertical-align:top" class="boldsmall"> <asp:label runat="server" id="lblname" text='<%# eval("globalconfigname")%>' /> </td> <td style="vertical-align:top" class="boldsmall"> <asp:textbox runat="server" id="tbvalue" cssclass="normalsmall" text='<%# eval("globalconfigvalue")%>' width="140" /> </td> </tr> </itemtemplate>
for textbox "tbvalue" need add range validator, range change depending on row of table displaying in repeater.
(e.g. first item of repeater has "idle time" globalconfigname , 20 globalconfigvalue; next item has "pickup time" globalconfigname , 60 globalconfigvalue, ...)
thanks.
databind minimumvalue , maximumvalue on rangevalidator control.
<asp:rangevalidator controltovalidate="tbvalue" minimumvalue='<%# eval("minvalue") %>' maximumvalue='<%# eval("maxvalue") %>' type="integer" text="the value not within acceptable range!" runat="server" />
Comments
Post a Comment