Pergunta

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?

Foi útil?

Solução

Use ControlStyle-Width="25px" property.

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

Outras dicas

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;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top