Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with a nested repeater

Problem with a nested repeater

Scheduled Pinned Locked Moved ASP.NET
help
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    simsen
    wrote on last edited by
    #1

    Hi, I'm trying to work with nested repeaters. I have repeater 1(called repDetails), where I list errors (from table 1). To each error (row from table 1) there is a file list (from table 2). Each row with error has a unique errorCyklusId witch also is used in table 2 (so I can see which files belongs to which error) I want my nested repeater (called repFiles) to show alle file names (from table 2). I need to figure out, how I in ItemDataBound can find the first repeters errorcyklusId for each row and how I can call a control (in this case a hyperlink control) from ItemDataBound My code: ID: 1 protected void repDetails_ItemDataBound(object sender, RepeaterItemEventArgs e) 2 { 3 //int errorCyklusId = Convert.ToInt32(e.CommandArgument); 4 5 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) 6 { 7 try 8 { 9 ERSError error = new ERSError(); 10 11 DataTable filelist = null; 12 13 if (error.GetFileList(1, ref filelist) == Status.Success) 14 { 15 int companyid = Convert.ToInt32(Session[ERSConnect.CookieCompanyId]); 16 17 RepeaterItem item = e.Item; 18 Repeater repFiles = item.FindControl("repFiles") as Repeater; 19 repFiles.DataSource = filelist.DefaultView; 20 repFiles.DataBind(); 21 } 22 } 23

    P 1 Reply Last reply
    0
    • S simsen

      Hi, I'm trying to work with nested repeaters. I have repeater 1(called repDetails), where I list errors (from table 1). To each error (row from table 1) there is a file list (from table 2). Each row with error has a unique errorCyklusId witch also is used in table 2 (so I can see which files belongs to which error) I want my nested repeater (called repFiles) to show alle file names (from table 2). I need to figure out, how I in ItemDataBound can find the first repeters errorcyklusId for each row and how I can call a control (in this case a hyperlink control) from ItemDataBound My code: ID: 1 protected void repDetails_ItemDataBound(object sender, RepeaterItemEventArgs e) 2 { 3 //int errorCyklusId = Convert.ToInt32(e.CommandArgument); 4 5 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) 6 { 7 try 8 { 9 ERSError error = new ERSError(); 10 11 DataTable filelist = null; 12 13 if (error.GetFileList(1, ref filelist) == Status.Success) 14 { 15 int companyid = Convert.ToInt32(Session[ERSConnect.CookieCompanyId]); 16 17 RepeaterItem item = e.Item; 18 Repeater repFiles = item.FindControl("repFiles") as Repeater; 19 repFiles.DataSource = filelist.DefaultView; 20 repFiles.DataBind(); 21 } 22 } 23

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      Use

      tags to format your code. It's pretty much impossible to read your message.

      Paul Marfleet

      "No, his mind is not for rent
      To any God or government"
      Tom Sawyer - Rush

      S 1 Reply Last reply
      0
      • P pmarfleet

        Use

        tags to format your code. It's pretty much impossible to read your message.

        Paul Marfleet

        "No, his mind is not for rent
        To any God or government"
        Tom Sawyer - Rush

        S Offline
        S Offline
        simsen
        wrote on last edited by
        #3

        Hi, Thanks, I was not awear about I should that too...... I thought that code was that I should use........ Shall I know post my question again or how? Kind regards, simsen :-)

        P S 2 Replies Last reply
        0
        • S simsen

          Hi, Thanks, I was not awear about I should that too...... I thought that code was that I should use........ Shall I know post my question again or how? Kind regards, simsen :-)

          P Offline
          P Offline
          pmarfleet
          wrote on last edited by
          #4

          <pre/> tags are better for code listings. For instance:

          <asp:Repeater ID="repDetails" runat="server" OnItemDataBound="repDetails_ItemDataBound">
          <HeaderTemplate>
          </HeaderTemplate>
          <ItemTemplate>
          ID: <asp:Label ID="lblDetailsFiles" runat="server" Text='<%# Eval("errorCyklusId") %>'></asp:Label>
          <asp:Repeater ID="repFiles" runat="server">
          <ItemTemplate> <asp:HyperLink ID="lnkFile" runat="server" Text='<%# Eval("fileName") %>' Target="_blank" NavigateUrl=""></asp:HyperLink>
          </ItemTemplate>
          </asp:Repeater>
          </ItemTemplate>
          <FooterTemplate>
          </FooterTemplate>
          </asp:Repeater>

          Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

          1 Reply Last reply
          0
          • S simsen

            Hi, Thanks, I was not awear about I should that too...... I thought that code was that I should use........ Shall I know post my question again or how? Kind regards, simsen :-)

            S Offline
            S Offline
            simsen
            wrote on last edited by
            #5

            Yes I understood you. I hope you can help me with my problem instead....... I cann't figure out, how I get the rows "signature", so I can call the database again for selecting to the nested repeater. And how I can change the NavigateURL for each row in the nested repeater? My code:

                ID: \]\]>'>
                
                   \]\]>' Target="\_blank" NavigateUrl="">                                                                                                                      
            

            1 protected void repDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
            2 {
            3 //int errorCyklusId = Convert.ToInt32(e.CommandArgument);
            4
            5 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            6 {
            7 try
            8 {
            9 ERSError error = new ERSError();
            10
            11 DataTable filelist = null;
            12
            13 if (error.GetFileList(1, ref filelist) == Status.Success)
            14 {
            15 int companyid = Convert.ToInt32(Session[ERSConnect.CookieCompanyId]);
            16
            17 RepeaterItem item = e.Item;
            18 Repeater repFiles = item.FindControl("repFiles") as Repeater;
            19 repFiles.DataSource = filelist.DefaultView;
            20 repFiles.DataBind();
            21 }
            22 }
            23 catch
            24 { }
            25 }
            26 }

            Kind regards, simsen :-) Kind regards, simsen :-)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups