Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 2nd, 2003, 04:53 PM
Authorized User
 
Join Date: Oct 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default Repeater

I have a class in another project called Order.ErrorDescription which is an arraylist. eStr returns a set of errors i.e. if a user entered the email address wrong then a message is displayed, if the telephone number entered is in the wrong format then a different error message appears. However, i would like to display that information in a neat and presentable format on my webform and that is why i thought of using a repeater. Can someone please help me with the right format? Currently it only returns the email error even if there are other errors.

aspx.vb
Order.ValidateValues = False

        Dim errStr As String


        If Not Order.Validate() Then

            For Each eStr As String In Order.ErrorDescription

                errStr = (eStr & "<BR>")
                Repeater1.DataSource = (errStr)

                Repeater1.DataBind()
            Next
        End If


aspx:
<TR>
<TD><asp:repeater id="Repeater1" runat="server">
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>
</asp:repeater>
</TD>
</TR>



 
Old December 2nd, 2003, 05:30 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You're missing the point of the repeater. The repeater repeats a template for each item in your enumerable object. It does the for-each for you. Try this:

aspx.vb:
Order.ValidateValues = False

If Not Order.Validate() Then
    Repeater1.DataSource = Order.ErrorDescription
    Repeater1.DataBind()
End If

aspx:
<TR>
<TD><asp:repeater id="Repeater1" runat="server">
<ItemTemplate>
<%# Container.DataItem %><br>
</ItemTemplate>
</asp:repeater>
</TD>
</TR>

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
why do Repeater is used... kk_katepally General .NET 1 December 22nd, 2004 06:36 PM
Repeater chiraagb ADO.NET 1 May 31st, 2004 02:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.