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. Other Discussions
  3. The Weird and The Wonderful
  4. Problem?

Problem?

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpjavascripthtmlasp-netdatabase
2 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.
  • G Offline
    G Offline
    glhrmbhnrt
    wrote on last edited by
    #1

    Why use repeaters/datalists/grids when you can do it via a foreach loop and throw the whole string on a div.innerHTML? :doh: The item template never changes, and the guy keep doing it via code. :(( Am i unlucky? Look.

    /*
    some code done here....
    database select, some ifs...
    */
    string html = "";
    int cnt = 1;
    foreach (DataRow reg in Data.Rows)
    {
    if (cnt > 3)
    {
    html+= "";
    cnt = 1;
    }

    html += "";

    cnt++;
    

    }
    html += "

    " +
    "" +
    " " +
    " " +
    " " +
    "

    " +
    @" [![](" + vid+ "destaque/" + reg["some reg"].ToString() + ")](javascript: void(0))
    " +
    @" [" + reg["some reg"] + "](javascript: void(0))

    " +
    "

    " +
    "

    ";

    divHtml.InnerHtml = html;

    That's my bro, there's an classic asp tag to use in asp.net? Maybe he needs it. It's a ascx with 150 lines. 100 lines on this method. Also StringBuilder() and String.Format() seems to be useless. Now imagine out how to update this layout;

    return true;

    B 1 Reply Last reply
    0
    • G glhrmbhnrt

      Why use repeaters/datalists/grids when you can do it via a foreach loop and throw the whole string on a div.innerHTML? :doh: The item template never changes, and the guy keep doing it via code. :(( Am i unlucky? Look.

      /*
      some code done here....
      database select, some ifs...
      */
      string html = "";
      int cnt = 1;
      foreach (DataRow reg in Data.Rows)
      {
      if (cnt > 3)
      {
      html+= "";
      cnt = 1;
      }

      html += "";

      cnt++;
      

      }
      html += "

      " +
      "" +
      " " +
      " " +
      " " +
      "

      " +
      @" [![](" + vid+ "destaque/" + reg["some reg"].ToString() + ")](javascript: void(0))
      " +
      @" [" + reg["some reg"] + "](javascript: void(0))

      " +
      "

      " +
      "

      ";

      divHtml.InnerHtml = html;

      That's my bro, there's an classic asp tag to use in asp.net? Maybe he needs it. It's a ascx with 150 lines. 100 lines on this method. Also StringBuilder() and String.Format() seems to be useless. Now imagine out how to update this layout;

      return true;

      B Offline
      B Offline
      BobJanova
      wrote on last edited by
      #2

      Maybe he just wants tables, not the random crap (not working in some browsers) you can get from using an ASP control.

      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