|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Validation on controls within a repeaterHai there!
I've build a web user control which contains a repeater control. This repeater control has several textboxes which need to be validated. The repeater is bound to a dataset that contains a datatable with empty rows. The validation I need is to check whether a value has been provided (like Required). So, if the datatable has 3 rows, then the repeater shows also 3 item rows each containing the textboxes. How to do the validation on the textboxes? Thanxxxxx... Octavie -- ===================== We're allmost at the future! When we get there, we can rest for a while... Hi,
just place a RequiredFieldValidator inside the same ItemTemplate where TextBox to be validated is located (and give it the ID of the TextBox to ControlToValidate attribute). <%-- repeater item starts here --%> <ItemTemplate> <asp:TextBox ID="txtInrepeater" runat="server" /> <asp:RequiredFieldValidator ControlToValidate="txtInrepeater" runat="server" ErrorMessage="Input required!">*</asp:RequiredFieldValidator> </ItemTemplate> <%-- repeater item ends here --%> This way every TextBox created by binding the repeater aso ahs associated RequiredFieldValidator which means that input must be provided for each of them. -- Show quoteTeemu Keiski ASP.NET MVP, AspInsider Finland, EU "Octavie" <Octa***@discussions.microsoft.com> wrote in message news:D67BB226-E4C7-4B88-AC55-0452572DD126@microsoft.com... > Hai there! > > I've build a web user control which contains a repeater control. This > repeater control has several textboxes which need to be validated. The > repeater is bound to a dataset that contains a datatable with empty rows. > > The validation I need is to check whether a value has been provided (like > Required). So, if the datatable has 3 rows, then the repeater shows also 3 > item rows each containing the textboxes. > > How to do the validation on the textboxes? > > Thanxxxxx... > Octavie > > -- > ===================== > We're allmost at the future! When we get there, we can rest for a while...
Other interesting topics
|
|||||||||||||||||||||||