Click here to Skip to main content
15,908,768 members

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, embarrassing 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.

 
GeneralStupid of the day Pin
Gary Wheeler22-Aug-11 0:26
Gary Wheeler22-Aug-11 0:26 
GeneralRe: Stupid of the day Pin
Nagy Vilmos22-Aug-11 0:37
professionalNagy Vilmos22-Aug-11 0:37 
GeneralRe: Stupid of the day Pin
Gary Wheeler22-Aug-11 0:43
Gary Wheeler22-Aug-11 0:43 
GeneralRe: Stupid of the day Pin
Rob Grainger22-Aug-11 5:47
Rob Grainger22-Aug-11 5:47 
GeneralRe: Stupid of the day Pin
Shameel22-Aug-11 6:06
professionalShameel22-Aug-11 6:06 
GeneralRe: Stupid of the day Pin
Sander Rossel22-Aug-11 10:59
professionalSander Rossel22-Aug-11 10:59 
GeneralRe: Stupid of the day Pin
RyanEK22-Aug-11 21:05
RyanEK22-Aug-11 21:05 
GeneralEvery day I die a little more... PinPopular
Keith Barrow21-Aug-11 1:21
professionalKeith Barrow21-Aug-11 1:21 
How to generate an ASP.NET menu, if you are an evil genius

First one must define what it is we are to show (apologies for the odd characters, it is badly endoded arabic):
C#
private string memberMenu = @"<table border=0 cellpadding=1 cellspacing=1 width=100% dir=rtl style=font-family:Tahoma;font-size:12px;><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MembersResearchList.aspx?t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ÃÈÍÇË æÏÑÇÓÇÊ\');return false;"" class=""navMenu"">ÃÈÍÇË æÏÑÇÓÇÊ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'AddMembersExperience.aspx\');top.SetTitle(\'ÇáÎÈÑÇÊ\');return false;"" class=""navMenu"">ÇáÎÈÑÇÊ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'AddMembersAcademicRank.aspx\');top.SetTitle(\'ÇáÑÊÈÉ ÇáÚáãíÉ\');return false;"" class=""navMenu"">ÇáÑÊÈÉ ÇáÚáãíÉ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MemberQualificationList.aspx?t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ãÄåá ÇßÇÏíãí\');return false;"" class=""navMenu"">ãÄåá ÇßÇÏíãí</a></td></tr><tr><td><a href=""#"" onclick=""{0}"" class=""navMenu"">ÊÍãíá ÇáÓíÑÉ ÇáÐÇÊíÉ</a></td></tr><tr><td><a href=""#"" onclick=""{1}"" class=""navMenu"" title=""ÌÏæá ÇáãæÇÏ ÇáÊÚáíãíÉ"">ÌÏæá ÇáãæÇÏ ÇáÊÚáíãíÉ</a></td></tr><tr><td><a href=""#"" onclick=""window.open(\'loadEduGate.htm\'); return false;"" class=""navMenu"">ÇáÈæÇÈÉ ÇáÅáßÊÑæäíÉ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MarksMainPage.aspx\');top.SetTitle(\'äÙÇã ÇáÚáÇãÇÊ ÇáÑÓãí áÃÚÖÇÁ ÇáåíÆÇÊ ÇáÊÏÑíÓíÉ ÈÌÇãÚÉ ÇáÈÊÑÇ\');return false;"" class=""navMenu"">äÙÇã ÇÏÎÇá ÇáÚáÇãÇÊ</a></td></tr></table>";


Then one must show it:

C#
lblScript.Text = @"<script type='text/javascript'>document.getElementById('navContent').innerHTML='" + string.Format(memberMenu, @"top.SetLocation(\'\',\'\',\'ListOfMemberCVs.aspx?mid=" + (new FacultyMembers()).GetMemberByUserName(sUserName + "@uop.edu.jo").Rows[0]["membersID"].ToString() + @"&t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ÇáÓíÑÉ ÇáÐÇÊíÉ\');return false;", @"top.SetLocation(\'\',\'\',\'../Courseslist/Default.aspx?d=" + ReserveTicketForUser(sUserName, pwd, userType + "," + pwd) + "&mid=" + (new FacultyMembers()).GetMemberByUserName(sUserName + "@uop.edu.jo").Rows[0]["membersID"].ToString() + @"&t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'My Courses\');return false;") + @"';</script>";


All I wanted to do was to show a link that only the developers could see so we can test a critical system we are migrating to live, this leaves me no opportunity to do so. Some stuff I can put down to bad design decisions, but this I can't explain away.

GeneralRe: Every day I die a little more... Pin
Nagy Vilmos22-Aug-11 0:39
professionalNagy Vilmos22-Aug-11 0:39 
GeneralRe: Every day I die a little more... Pin
Keith Barrow22-Aug-11 3:37
professionalKeith Barrow22-Aug-11 3:37 
GeneralRe: Every day I die a little more... Pin
Nagy Vilmos22-Aug-11 21:52
professionalNagy Vilmos22-Aug-11 21:52 
GeneralRe: Every day I die a little more... Pin
CDP180223-Aug-11 0:17
CDP180223-Aug-11 0:17 
GeneralRe: Every day I die a little more... Pin
Keith Barrow23-Aug-11 3:06
professionalKeith Barrow23-Aug-11 3:06 
GeneralRe: Every day I die a little more... Pin
CDP180223-Aug-11 0:12
CDP180223-Aug-11 0:12 
GeneralZombie Application? Pin
nedmech18-Aug-11 9:52
nedmech18-Aug-11 9:52 
GeneralRe: Zombie Application? Pin
Ian Shlasko18-Aug-11 10:19
Ian Shlasko18-Aug-11 10:19 
GeneralRe: Zombie Application? Pin
OriginalGriff18-Aug-11 22:46
mveOriginalGriff18-Aug-11 22:46 
GeneralRe: Zombie Application? Pin
Simon Bang Terkildsen21-Aug-11 20:28
Simon Bang Terkildsen21-Aug-11 20:28 
GeneralRe: Zombie Application? Pin
loctrice18-Jan-12 18:31
professionalloctrice18-Jan-12 18:31 
GeneralYAVBH Pin
Rob Grainger18-Aug-11 6:03
Rob Grainger18-Aug-11 6:03 
GeneralRe: YAVBH Pin
Peter_in_278018-Aug-11 11:57
professionalPeter_in_278018-Aug-11 11:57 
GeneralRe: YAVBH Pin
Rob Grainger18-Aug-11 23:31
Rob Grainger18-Aug-11 23:31 
JokeRe: YAVBH Pin
Julien Villers21-Aug-11 22:38
professionalJulien Villers21-Aug-11 22:38 
GeneralRe: YAVBH Pin
Rob Grainger22-Aug-11 5:41
Rob Grainger22-Aug-11 5:41 
Generalstrange way to handle click event of button placed in GridView Pin
M I developer17-Aug-11 21:33
professionalM I developer17-Aug-11 21:33 

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

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