itemstyle width is not working in mozilla

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mohan raju
    New Member
    • Oct 2011
    • 2

    itemstyle width is not working in mozilla

    Code:
    <asp:TemplateColumn >
      <HeaderStyle Font-Bold="True" Width="70px"></HeaderStyle>
      <ItemStyle HorizontalAlign="Right" Width ="55px" VerticalAlign="Top"></ItemStyle>
      <HeaderTemplate>
        <asp:Label id="LabelEmployeeCost" Runat="server" >
              Employee<br>Cost
        </asp:Label>
      </HeaderTemplate>
      <ItemTemplate>
        <asp:Label runat="server"  Text='<%# DataBinder.Eval(Container, "DataItem.EmployeeCost") %>' id="Label3" ></asp:Label>
      </ItemTemplate>
    </asp:TemplateColumn>


    In this width="px" is not working in Mozilla browser please let me know ASAP.

    Thanks in advance...
    Last edited by Frinavale; Oct 17 '11, 02:00 PM. Reason: Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Try moving the width into the Label instead...
    Labels (when rendered as HTML) are <span> elements. These elements have an "display:inline " style by default which means that you can't set a width on them (well you can but it won't do anything). Change the display style for the Label to "display:bl ock" and set the "width:70px ".

    Like this:
    Code:
    <asp:TemplateColumn >
      <HeaderStyle></HeaderStyle>
      <ItemStyle HorizontalAlign="Right" Width ="55px" VerticalAlign="Top"></ItemStyle>
      <HeaderTemplate>
        <asp:Label id="LabelEmployeeCost" 
                   runat="server"
                   style="display:block; width:70px; font-weight:bold">
              Employee<br>Cost
        </asp:Label>
      </HeaderTemplate>
      <ItemTemplate>
        <asp:Label runat="server"  Text='<%# DataBinder.Eval(Container, "DataItem.EmployeeCost") %>' id="Label3" ></asp:Label>
      </ItemTemplate>
    </asp:TemplateColumn>
    Let me know how it goes.

    -Frinny

    Comment

    • mohan raju
      New Member
      • Oct 2011
      • 2

      #3
      Hi Frinny ,
      Still i am getting same problem in Mozilla Firefox but , whatever u send the code which is working fine in IE.
      Thanks
      Mohan Raju

      Comment

      Working...