DataList example from Prosise yields no output - don't know why

Discussion in 'ASP .Net' started by Richard Lionheart, Sep 5, 2005.

  1. Hi All,

    I took the code from Prosise's DataList example and copied judiciously (I
    think) into a new WebForm application. I got only a blank user page as
    output. I set breakpoints on statements in the Page_Load but none of them
    fired. Below is the code from WebForm1.aspx. Any ideas?

    Thanks in advance,
    Richard

    <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
    Inherits="TestRepeaterControls.WebForm1" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:Repeater ID="MyRepeater" RunAt="server">
    <ItemTemplate>
    <%# Container.DataItem %>
    <br>
    </ItemTemplate>
    </asp:Repeater>
    </form>
    </body>
    </HTML>

    <script language="C#" runat="server">
    void Page_Load (Object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    string[] beatles = { "John", "Paul", "George", "Ringo" };
    MyRepeater.DataSource = beatles;
    MyRepeater.DataBind ();
    }
    }
    </script>
     
    Richard Lionheart, Sep 5, 2005
    #1
    1. Advertising

  2. Sorry Folks,

    I misspoke: I said I took the code from Prosise's DataList example. In
    fact, I took it from the Repeater example. Nevertheless, I think what I
    created should have resulted in some data in the output user window.

    There is one thing that might be a problem. I'm running WinXP/SP2 and some
    examples I created have lead to a security warning in a bar at the top of
    the screen. I didn't see that with this example.

    Regards,
    Richard
     
    Richard Lionheart, Sep 5, 2005
    #2
    1. Advertising

  3. Richard Lionheart

    Onin Tayson Guest

    Try changing AutoEventWireup="false" to AutoEventWireup="true"

    HTH,

    "Richard Lionheart" <> wrote in message
    news:OKw%...
    > Hi All,
    >
    > I took the code from Prosise's DataList example and copied judiciously (I
    > think) into a new WebForm application. I got only a blank user page as
    > output. I set breakpoints on statements in the Page_Load but none of them
    > fired. Below is the code from WebForm1.aspx. Any ideas?
    >
    > Thanks in advance,
    > Richard
    >
    > <%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
    > AutoEventWireup="false" Inherits="TestRepeaterControls.WebForm1" %>
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    > <HTML>
    > <HEAD>
    > <title>WebForm1</title>
    > <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    > <meta name="CODE_LANGUAGE" Content="C#">
    > <meta name="vs_defaultClientScript" content="JavaScript">
    > <meta name="vs_targetSchema"
    > content="http://schemas.microsoft.com/intellisense/ie5">
    > </HEAD>
    > <body MS_POSITIONING="GridLayout">
    > <form id="Form1" method="post" runat="server">
    > <asp:Repeater ID="MyRepeater" RunAt="server">
    > <ItemTemplate>
    > <%# Container.DataItem %>
    > <br>
    > </ItemTemplate>
    > </asp:Repeater>
    > </form>
    > </body>
    > </HTML>
    >
    > <script language="C#" runat="server">
    > void Page_Load (Object sender, EventArgs e)
    > {
    > if (!IsPostBack)
    > {
    > string[] beatles = { "John", "Paul", "George", "Ringo" };
    > MyRepeater.DataSource = beatles;
    > MyRepeater.DataBind ();
    > }
    > }
    > </script>
    >
    >
     
    Onin Tayson, Sep 5, 2005
    #3
  4. Hi Onin,

    That did it! Many thanks. I've got a different problem with the DataList
    example, but I'' start a separate thread for it. Meanwhile I'll hunt for
    documentation on AutoEventWireup.

    Regards,
    Richard

    Tayson" <> wrote in message
    news:%...
    > Try changing AutoEventWireup="false" to AutoEventWireup="true"
    >
    > HTH,
     
    Richard Lionheart, Sep 5, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DP
    Replies:
    0
    Views:
    1,179
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,226
    Smokey Grindel
    Dec 2, 2006
  3. Richard Lionheart

    Problem running a Jeff Prosise example

    Richard Lionheart, Oct 25, 2005, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    139
    Richard Lionheart
    Oct 26, 2005
  4. x1
    Replies:
    11
    Views:
    278
  5. Andries

    I know, I know, I don't know

    Andries, Apr 23, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    279
    Gregory Toomey
    Apr 23, 2004
Loading...

Share This Page