Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 30th, 2007, 12:45 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default [Discussion] - Crazy or Odd .NET Hacks

So I was sitting at my desk minding my own business working on a client's website when I needed to integrate some Server Controls into the UI, no big deal.

So I pull the code the designer had used for the mockup and looked it over and came up with this requirement:
I had to replace a text box and an image with a TextBox and an ImageButton. 10 minutes tops.

Well, these 2 particular elements needed to be enclosed within a User Control so the code that had to be dropped into the user control looked like:

Code:
      <td width="100" 
            background="image.gif">
         <label>
          <div align="center">
           <input name="search" type="text" id="search" size="10" />
          </div>
         </label>
        </td>
        <td width="42">
         <img name="go_button"
              src="image.gif" width="42" 
              height="32" border="0" id="go_button" alt="Go Button" />
        </td>
No problem. So I replaced the textbox and image with a TextBox and ImageButton control, saved it, viewed my page and, for some reason, the UI was blown out 2px. >< I narrowed it down to the image button and tried changing all the relevant properties (width, height, etc) to no avail.

Ok. I replaced the image button with an html image button but, again, the UI was blown out 2px. At this point I was mildly frustrated. Unforunately, I couldn't simply wrap the image in an anchor tag as I needed the control to post back and do some processing before I redirected to another page.

Ultimately I ended up doing this:
Code:
<asp:LinkButton ID="lbBtn" runat="server" OnClick="lbBtn_Click">
<img name="go_button" src="image.gif" width="42"
     height="32" border="0" id="go_button" alt="Go Button" />
</asp:LinkButton>


So what about the rest of you, any crazy or otherwise odd hacks that you have had to employ to meet a requirement that you would like to share?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 
Old August 31st, 2007, 08:28 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Doug,

Did you compare the resulting HTML for these various attempts? Have you used something like Firebug? That could give you the answer as to where the 2px offset if coming from.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Almost crazy trevo4f BOOK: Beginning ASP 3.0 2 May 15th, 2008 11:22 AM
SQL Crazy Query... devendar SQL Server 2005 4 July 19th, 2007 12:51 AM
Crazy scrollbar issue Teessider_2000 CSS Cascading Style Sheets 3 August 21st, 2006 07:41 AM
Discussion: Code-Behind vs. Inline in ASP.Net planoie ASP.NET 1.x and 2.0 Application Design 3 September 20th, 2004 02:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.