Follow me on Twitter at Twitter.com/wbm
FYI, I'm blogging most of my stuff over at More Wally now.
You might want to add my rss feed to your reader at:http://morewally.com/cs/blogs/wallym/rss.aspx
ASP.NET Podcast Show #93 - ASP.NET ListView in Orcas Beta 1 - Video - Wallace B. McClure

Wallace B. McClure

All About Wally McClure - The musings of Wallym on .NET, Sql, ASP.NET, and other crazy shenanigans

News

Personal Blog

Work Blog

.NET

Book Authors

Business

Family

Friends

Georgia Tech Bloggers

Personal

ASP.NET Podcast Show #93 - ASP.NET ListView in Orcas Beta 1 - Video

Original URL: http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2007/05/23/asp-net-podcast-show-93-asp-net-listview-in-orcas-beta-1-video.aspx

Subscribe

Download WMV

Download MP4

Show Notes:

  • ASP.NET ListView.
  • ListView as a Grid.
  • ListView as a Container of data.

Source Code:

ASPX Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ListView.aspx.cs" Inherits="ListView" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ListView Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ListView ID="ListView1" runat="server" ItemContainerID="tblData">
    <layouttemplate>
        <table border="1">
            <tr>
                <th>Name</th>
            </tr>
            <tbody runat="server" id="tblData"></tbody>
        </table>
    </layouttemplate>
    <itemtemplate>
    <tr>
        <td><%# Eval("Name") %></td>
    </tr>
    </itemtemplate>
    </asp:ListView>
    <asp:ListView ID="ListView2" runat="server" ItemContainerID="ddlSelect">
    <LayoutTemplate>
        <select ID="ddlS" name="ddlS">
            <asp:PlaceHolder ID="ddlSelect" runat="server"></asp:PlaceHolder>
        </select>
    </LayoutTemplate>
    <ItemTemplate>
        <option><%# Eval("Name") %></option>
    </ItemTemplate>
    </asp:ListView>
    </div>
    </form>
</body>
</html>

Code Behind .cs file:

protected void Page_Load(object sender, EventArgs e)
{
    DataTable dtData = new DataTable();
    DataRow drData;
    dtData.Columns.Add( "Name", System.Type.GetType("System.String"));
    drData = dtData.NewRow();
    drData["Name"] = "Wally McClure";
    dtData.Rows.Add(drData);
    drData = dtData.NewRow();
    drData["Name"] = "Paul Glavich - my trusty sidekick";
    dtData.Rows.Add(drData);
    ListView1.DataSource = dtData;
    ListView1.DataBind();
    ListView2.DataSource = dtData;
    ListView2.DataBind();
}

PS.  Due to a snafu with my DNS Server, the site was inaccessible for a while today.  As a result, I took this post offline and put it back on once the server was back up and going. 

Comments

» ASP.NET Podcast Show #93 - ASP.NET ListView in Orcas Beta 1 - Video said:

Pingback from  &raquo; ASP.NET Podcast Show #93 - ASP.NET ListView in Orcas Beta 1 - Video

# May 23, 2007 9:44 AM

Peter said:

First of all, I think ListView is not a good name for this control. It's more like a different take on the repeater. There was one thing in the video that was not exactly clear and that kind of worries me; something about ListView replacing the Repeater. I have nothing against having an extra control, but there's no reason why the Repeater couldn't stay. The Repeater is one of those simple but powerful controls. There's no need to explain why you need a control inside a template and to have that hooked up with an ID (for ListView). It's just simple and the results are very easy to predict. Also not having control over the outputted html (see the span tag around the control) is very bad!

Peter.

P.S. maybe TemplatedRepeater would be a better name(?)

# May 23, 2007 2:07 PM

Brad Abrams said:

Daniel Moth has a good post describing .NET Framework 3.5 ... I though i'd share part of it here as it

# June 12, 2007 10:32 AM

?????????? ?????? ?????????? ?????? » Blog Archive » Genuine Windows is Ubuntu!!! said:

Pingback from  ?????????? ?????? ?????????? ??????  &raquo; Blog Archive   &raquo; Genuine Windows is Ubuntu!!!

# June 18, 2007 10:29 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)