Ejemplo de ListView en ASP.NET 3.5

Que tal, después de unos largos días de descanso publicare un pequeño ejemplo de como usar estos nuevos controles que vienen incluidos en ASP.NET 3.5 Extensions, creando una website con un XML que en este caso será nuestro feed del blog y mostrandolo en la lista.

1.-Instalamos las extensiones de ASP.NET 3.5 en nuestro Visual Studio 2008.

2.-Creamos una nueva website.

asp1

3.-Colocamos un ListView en nuestra pagina.

asp2

4.-Seleccionamos un XML DataSource con las siguientes opciones:

Nombre de tu URL de Feed de tu Blog,y el Path, como se muestra en la figura:

asp3

5.-Y ahora nos iremos al modo source para poder agregar lo que son itemtemplates, layout templates, que nos pide lo que es el listview para poder mostrar nuestros datos.

<asp:ListView ID="ListView1" runat="server" DataSourceID="XmlDataSource1">
        <LayoutTemplate>
        </LayoutTemplate>
        <ItemTemplate>
        </ItemTemplate>

</asp:ListView>

Aquí tengo que aclarar un punto importante, es necesario en la parte de Layout Template añadir un Place Holder de nuestros controles, y colocar en su ID "itemPlaceHolder" para que el ListView pueda reconocer y adaptarse a el indicando que sera el contenedor para cada elemento que se agregará mediante el XML.

<LayoutTemplate>
         <br />
         MrEdison Blog RSS
         <br />
            <asp:PlaceHolder  ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>

</LayoutTemplate>

 

En el ItemTemplate colocaremos ciertos puntos importantes, los cuales son el link de cada post, los cuales serán los títulos, además de colocar la fecha de publicación de cada uno y su descripcion.

<ItemTemplate>
             <h2><a href='<%# XPath("link") %>’><%#XPath("title")%></a></h2>
             <p><em>Publicado el <%#XPath("pubDate")%></em></p>
             <p><%#XPath("description")%></p>
  </ItemTemplate>

Quedando de esta forma:

asp4

Podemos añadirle nuestro diseño quedaría finalmente así:

asp5

Un comentario sobre “Ejemplo de ListView en ASP.NET 3.5”

  1. Hello,

    My name is Andrew, I’m working in European company «Bidding Expert inc».
    Bidding Expert Inc. is a unique company that provides a variety of services to buyers and sellers on the virtual auction web site eBay as well as on many online stores like Amazon, BestBuy, B&H and IBM. Bidding Expert acts as a facilitator to help make payments to third parties for purchases made on eBay and online stores. Our services fill the gap for international buyers and sellers that are unable to fully participate in e-commerce due to inefficiencies of the banking and PayPal system in their countries. The services are mainly oriented for clients from the former Soviet Union, Eastern Europe and Israel.

    We invite citizens from other countries for cooperation. Functions of the regional agent: receiving and cashing out payments from our customers (for goods, auction items and etc.) and then transferring funds to our European clients.

    If you make a decision to work with us, you’ll have to:

    work no less than 2 hours per day (possibly in the evening);
    check your e-mail box several times a day;
    you should have opened PayPal.com account(If you don’t have one, you can register at paypal.com) because our clients buy and sell items through PayPal ;
    be a legal resident in the territory of the USA or European Union;
    be of maturity age.

    Your commission will be equal 10% from each sale/resale operation we make!

    For instance: you receive a $1000 USD to your paypal account. You withdraw the money and keep $100 (10% of $1000) for yourself. Your net income is $100. The rest of the money you transfer to our European clients by Western Union or MoneyGramm.

    No special expertise or knowledge in any specific areas is needed.

    You will enjoy working with us as you’ll have a real opportunity to work as an independent contractor and to earn money right from your virtual home office.

    How you can apply this part time job ? It is easy as 1,2,3..

    1. Please contact me by e-mail: andrew_gubert@yahoo.com, if you can`t see my e-mail on this page: andrew_gubert(@)yahoo.com
    2. I will send you application form which you should fill, print, sign and send back to my e-mail.
    3. You should scan and send me your ID (passport or driver licence).

    Why we need your photo or scanned copy of your documents?

    We needed scanned copy of your documents (you can close SSN or DL numbers) to verify that you live at current address. There are two simple reasons for this:

    First of all, we have already encountered problems when manager candidates gave us the fake street addresses or the address of the neighbor. As a result the agent has stolen money.

    Secondary, we do not hire people under 18. You may scan your DL or passport. It is up to you. We recommend blacking out the Social Security and Driver License numbers. There is a risk that someone else can gain access to the e-mail and steal this private information. We just need to see your full name and Full Street address on this copy.

    Also we provide transactions as exchange PayPal to E-gold, Ukash, Liberty Reserve for -10%, for example: we send you paypal $1000, you should send us $900 Liberty Reserve, Ukash or e-gold.

    Thank you.
    Bidding Expert inc.
    Andrew Gubert

Responder a anonymous Cancelar respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *