Saturday 21 July 2012

Beginning .Net : Specify the width of the TextBox

As a .Net Beginners you must know how to set textbox width.
You can set "width" property of TextBox control to set width.
You can set "width" property in Pixel or Percentage wise.

Here is Example for this.
In this example we are setting different width in pixel as well as percentage.

ASPX Code :
<asp:TextBox runat="server" ID="txt1"></asp:TextBox>
<asp:TextBox runat="server" ID="TextBox1" Width="10px"></asp:TextBox>
<asp:TextBox runat="server" ID="TextBox2" Width="20px"></asp:TextBox>
<asp:TextBox runat="server" ID="TextBox3" Width="200px"></asp:TextBox>
<asp:TextBox runat="server" ID="TextBox4"  Width="20%"></asp:TextBox>
<asp:TextBox runat="server" ID="TextBox5" Width="100%"></asp:TextBox>

Output :
(To view original image , click on image)

Here in output we made slightly changes we display textbox with it's actual html tag, so you can easily differentiate it's width.


Note : Give Us your valuable feedback in comments. Give your suggestions in this article so we can update our articles accordingly that.



No comments:

Post a Comment