1

Silly question...

Code:

<asp:BoundField DataField="PrevDuration" HeaderText="Prev." 
            SortExpression="PrevDuration" ItemStyle-Width="25">
        </asp:BoundField>

Html output:

<td style="width:25px;"><input name="ctl00$MainContent$GridView1$ctl03$ctl02" type="text" value="1" size="5" title="Prev."></td>

So this code specifies the td width, but how instead can I specify the input width?

PS. by the way where does that size=5 comes out from?

spiderman
  • 1,565
  • 2
  • 16
  • 37

2 Answers2

1

Give it a cssclass and set the width in there

 <asp:BoundField DataField="PrevDuration" 
         HeaderText="Prev." 
         SortExpression="PrevDuration" 
         ItemStyle-Width="25"
         CssClass="inputs"> //note this
      </asp:BoundField>

CSS

.inputs{
   width:...px;
}
DiederikEEn
  • 753
  • 8
  • 17
1

Use ControlStyle-Width="25px" property.

<asp:BoundField DataField="PrevDuration" HeaderText="Prev." SortExpression="PrevDuration" ControlStyle-Width="25px">
</asp:BoundField>
Sachin
  • 40,216
  • 7
  • 90
  • 102