2012-01-28 2 views
1

나는이 이상한 문제가 있습니다. 다음과 같이 정의 된 일부 텍스트 상자가있는 설치가 있습니다.때로는 내 텍스트 상자가 스타일없이 렌더링됩니다.

<table style="width: 100%; position: relative; top: -10px;"> 
       <tr> 
        <td style="font-size: 9pt; text-align: left;"> 
         <asp:TextBox ID="multiHandle2_1_BoundControl" BackColor="Transparent" BorderStyle="None" 
          Font-Size="9pt" runat="server" Width="30" Text="25" /><span style="position: relative; 
           left: -11px;">DKK</span> 
        </td> 
        <td style="font-size: 9pt; text-align: right; float: right;"> 
         <asp:TextBox ID="multiHandle2_2_BoundControl" runat="server" Width="30" BackColor="Transparent" 
          BorderStyle="None" Font-Size="9pt" /><span style="position: relative; left: -5px;">DKK</span> 
        </td> 
       </tr> 
      </table> 

이제는 거의 항상 작동합니다. 그러나 출력 캐싱을 사용하고 내 사이트를 여러 번 경험했는데 HTML이 잘못 렌더링되었습니다. 렌더링 된 HTML을 살펴 보겠습니다. 그것이 잘못 렌더링

은 단순히 내 텍스트 상자에서 다음을 제거하고, (~ 시간의 95 %를 일) :

BackColor="Transparent" BorderStyle="None" 
           Font-Size="9pt" Width="30" Text="25" 

나는이 완벽하게 가장 적용되는 볼 수 있듯이이 정말 이상하다 시대의.

작동

, 그것은이 같은 렌더링 :
<table style="width: 100%; position: relative; top: -10px;"> 
      <tr> 
       <td style="font-size: 9pt; text-align: left;"> 
        <input name="ctl00$ctl00$ContentPlaceHolder1$LeftSidebar$Filters1$multiHandle2_1_BoundControl" type="text" value="149" id="ContentPlaceHolder1_LeftSidebar_Filters1_multiHandle2_1_BoundControl" style="background-color:Transparent;border-style:None;font-size:9pt;width:30px;" /><span style="position: relative; 
          left: -11px;">DKK</span> 
       </td> 
       <td style="font-size: 9pt; text-align: right; float: right;"> 
        <input name="ctl00$ctl00$ContentPlaceHolder1$LeftSidebar$Filters1$multiHandle2_2_BoundControl" type="text" value="249" id="ContentPlaceHolder1_LeftSidebar_Filters1_multiHandle2_2_BoundControl" style="background-color:Transparent;border-style:None;font-size:9pt;width:30px;" /><span style="position: relative; left: -5px;">DKK</span> 
       </td> 
      </tr> 
     </table> 

가 작동하지 않습니다

, 그것은 다음과 같이 표현된다 (happends 꽤 자주, 그러나, 항상). 차이점은 입력의 스타일이 GONE입니다. :

<table style="width: 100%; position: relative; top: -10px;"> 
      <tr> 
       <td style="font-size: 9pt; text-align: left;"> 
        <input name="ctl00$ctl00$ContentPlaceHolder1$LeftSidebar$Filters1$multiHandle2_1_BoundControl" type="text" value="13" id="ContentPlaceHolder1_LeftSidebar_Filters1_multiHandle2_1_BoundControl" /><span style="position: relative; 
          left: -11px;">DKK</span> 
       </td> 
       <td style="font-size: 9pt; text-align: right; float: right;"> 
        <input name="ctl00$ctl00$ContentPlaceHolder1$LeftSidebar$Filters1$multiHandle2_2_BoundControl" type="text" value="249" id="ContentPlaceHolder1_LeftSidebar_Filters1_multiHandle2_2_BoundControl" /><span style="position: relative; left: -5px;">DKK</span> 
       </td> 
      </tr> 

     </table> 

이렇게 ... ASP.NET - 무슨 일이 벌어지고 있습니까? 이것은 매우 성가신 ;-)

답변

0

당신이 썼다 이상하고 나는 "매우 성가신"확신 해요 ... 나는 왜 그것이 일어나고 있는지 잘 모르지만 당신은 css의 적절한 사용으로 해결할 수 있습니다.

요소에 스타일을 쓰는 대신 class을주고 해당 클래스의 스타일 정의를 css 파일에 넣으십시오.

+0

good _general_ advice ... 솔리드하고 완전한 대답은 실제 최종 코드를 보여줍니다. 기억해야 할 점은 렌더링 된 코드가 다른 ASP로 프로그래밍하고 있다는 것입니다 (_rendered_ inline CSS 참조). – Sparky

관련 문제