Click here to Skip to main content

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: come on give me a break !! PinmemberAnkush Bansal16-May-12 18:50 
GeneralRe: come on give me a break !! PinmemberPascal Ganaye8-Jun-12 11:15 
GeneralStatics Pinmemberwizardzz10-May-12 9:32 
GeneralRe: Statics PinmemberPIEBALDconsult10-May-12 9:36 
JokeRe: Statics PinprotectorAspDotNetDev10-May-12 10:11 
GeneralAaaaaaaaargh Pinmemberkrumia11-May-12 2:59 
GeneralRe: Statics Pinmemberekolis10-May-12 13:33 
GeneralRe: Statics PinmemberCIDev10-May-12 13:40 
GeneralRe: Statics PinmemberBernhard Hiller10-May-12 22:35 
GeneralRe: Statics PinmemberPIEBALDconsult11-May-12 5:13 
JokeRe: Statics PinmemberRahul Rajat Singh14-May-12 2:32 
GeneralRe: Statics PinmemberNaerling17-May-12 12:31 
GeneralRe: Statics PinmemberZac Greve23-May-12 13:08 
GeneralProblem? Pinmemberglhrmbhnrt10-May-12 2:57 
Why use repeaters/datalists/grids when you can do it via a foreach loop and throw the whole string on a div.innerHTML? D'Oh! | :doh:
 
The item template never changes, and the guy keep doing it via code. Cry | :((
 
Am i unlucky?
 
Look.
 
/*
   some code done here....
   database select, some ifs...
*/
string html = "<table><tr>";
int cnt = 1;
foreach (DataRow reg in Data.Rows)
{
   if (cnt > 3)
   {
       html+= "</tr><tr>";
       cnt = 1;
   }
   
   html += "<td height='210px' valign='top' align='left'>" +
         "<table align='left' height='100%' width='239px'>" +
           " <tr>" +
            "  <td valign='top'>" +
           @"   <a class="Registroclick" href="javascript: void(0)" idseg="0" idcat=" + reg["some reg"].ToString() + "  endereco='" + destpage+ "?idcat=" + reg["some reg"].ToString() + "'><img src='" + vid+ "destaque/" + reg["some reg"].ToString() + "' width='235' height='136' border='0'/></a>
" +
@"   <a class="Registroclick" href="javascript: void(0)" idseg="0" idcat=" + reg["some reg"].ToString() + "  endereco='" + destpage+ "?idcat=" + reg["some reg"].ToString() + "'>" + reg["some reg"] + "</a>
 
" +
           "  </td>" +
           " </tr>" +
          "</table>" +
      "</td>";
 
    cnt++;
}
html += "</tr></table>";
 
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;

GeneralRe: Problem? PinmemberBobJanova11-May-12 3:55 
GeneralReally??? PinmemberKP Lee9-May-12 20:36 
GeneralRe: Really??? Pinmemberglhrmbhnrt10-May-12 2:24 
GeneralRe: Really??? PinmemberCIDev10-May-12 4:08 
GeneralKinda guy Pinmemberglhrmbhnrt9-May-12 8:02 
GeneralRe: Kinda guy [modified] PinmemberCDP18029-May-12 21:08 
GeneralRe: Kinda guy PinmemberMohibur Rashid15-May-12 20:08 
GeneralRe: Kinda guy PinmemberBobJanova9-May-12 23:02 
GeneralRe: Kinda guy PinmemberCDP18029-May-12 23:14 
GeneralRe: Kinda guy PinmemberCIDev10-May-12 4:05 
GeneralRe: Kinda guy PinmemberPIEBALDconsult10-May-12 6:19 
GeneralConstant Headache PinprotectorAspDotNetDev7-May-12 15:04 
GeneralRe: Constant Headache Pinmemberekolis9-May-12 6:26 
GeneralRe: Constant Headache PinprotectorAspDotNetDev9-May-12 7:12 
GeneralRe: Constant Headache Pinmemberryanb3110-May-12 6:39 
GeneralRe: Constant Headache PinprotectorAspDotNetDev10-May-12 7:10 
GeneralRe: Constant Headache PinmemberJörgen Andersson11-May-12 8:44 
GeneralRe: Constant Headache PinprotectorAspDotNetDev11-May-12 10:34 
GeneralRe: Constant Headache PinprotectorAspDotNetDev12-May-12 10:13 
GeneralRe: Constant Headache PinmemberJörgen Andersson15-May-12 21:17 
GeneralRe: Constant Headache PinprotectorAspDotNetDev15-May-12 22:09 
GeneralRe: Constant Headache [modified] PinmemberAnkush Bansal12-May-12 6:26 
GeneralRe: Constant Headache PinmemberBobJanova11-May-12 3:56 
Generalbad SQL case PinmemberCode Monkey-Man7-May-12 10:19 
GeneralRe: bad SQL case PinmemberZac Greve7-May-12 11:44 
GeneralRe: bad SQL case PinmemberCode Monkey-Man7-May-12 11:55 
GeneralRe: bad SQL case PinmemberSentenryu8-May-12 9:14 
GeneralRe: bad SQL case PinmemberCode Monkey-Man8-May-12 11:41 
GeneralRe: bad SQL case PinmemberKP Lee9-May-12 21:13 
JokeApparently there is no limit to naming conventions for method Pinmemberthedavejay3-May-12 5:27 
GeneralRe: Apparently there is no limit to naming conventions for method PinmvpOriginalGriff3-May-12 5:58 
GeneralRe: Apparently there is no limit to naming conventions for method Pinmemberthedavejay3-May-12 6:23 
GeneralRe: Apparently there is no limit to naming conventions for method PinmemberGary Wheeler4-May-12 1:08 
GeneralRe: Apparently there is no limit to naming conventions for method PinmemberCIDev4-May-12 2:46 
GeneralRe: Apparently there is no limit to naming conventions for method Pinmemberwizardzz4-May-12 5:18 
GeneralRe: Apparently there is no limit to naming conventions for method PinmemberChris Meech3-May-12 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 21 Apr 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid