How to add ListView to RadMultiPage

3 posts, 0 answers
  1. Pablo
    Pablo avatar
    11 posts
    Member since:
    Jul 2008

    Posted 22 Jul 2008 Link to this post

    Hello, I am doing a news site. In the homepage I have a RadTabStrip and a RadMultiPage. In code behind, I am calling business logic to get the news categories, and then I add one tab and one pagview to show the news for each category.  I don't have problems with creating the tabs and pageviews.  They are created ok, I even added a Textbox to each one of the pageviews showing the category titile. 

    My problem is that I want to add a ListView, but I don't know how to create the ListView's childs programatically (layouttemplate, itemtemplate, etc), as a matter of fact it would seem a little bit odd to create those programmatically as they contain html markup.

    I tried to create the ListView as a User Control in an ascx file, but then when I call it from my codebehind like this:

    Dim

    LVEstudios As ListView = Page.LoadControl("~/Resources/ListViewParaMultiPageEstudios.ascx")

    I am getting this error in the line shown above:
    Unable to cast object of type 'ASP.resources_listviewparamultipageestudios_ascx' to type 'System.Web.UI.WebControls.ListView'.

    How can I tell the ascx file to be of type ListView ?  I think that would solve my problem.

    My ascx file looks like this:

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="ListViewParaMultiPageEstudios.ascx.vb" 
        Inherits="Resources_ListViewParaMultiPageEstudios" %> 
     
    <asp:ListView runat="server" ItemPlaceholderID="AquiVanItems">  
        <LayoutTemplate> 
            <asp:PlaceHolder ID="AquiVanItems" runat="server"></asp:PlaceHolder> 
        </LayoutTemplate> 
        <ItemTemplate> 
            <%#Eval("Nombre")%> 
            <br /> 
            <%#Eval("Orden")%> 
        </ItemTemplate> 
    </asp:ListView> 
     

    and its code behind:

     
    Partial Class Resources_ListViewParaMultiPageEstudios  
        Inherits System.Web.UI.UserControl  
     
     
    End Class 


    Any ideas?  I hope I made myself clear.

  2. Pablo
    Pablo avatar
    11 posts
    Member since:
    Jul 2008

    Posted 22 Jul 2008 Link to this post

    Ok I am binding the listview in the .ascx.vb file.
    But how do I pass parameters?
  3. Pablo
    Pablo avatar
    11 posts
    Member since:
    Jul 2008

    Posted 22 Jul 2008 Link to this post

    Nevermind, I solved it.
Back to Top