Click here to Skip to main content
15,890,717 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey all,

it´s an easy question, hopefully.
I have 2 buttons, text lengh is different. I want to have both with the same lengh/width. Is there an easy way to get this?

XML
<asp:Button ID="Button_Config_iPhone"
runat="server"
onclick="Button_CreateConfiguration_iPhone4"
Text="iPhone"
ToolTip="iPhone "
 /><br /><br />

<asp:Button ID="Button_Config_WinMob"
runat="server"
onclick="Button_CreateConfiguration_WindowsMobile"
Text="Windows Mobile Phone"
ToolTip="Windows Mobile Phone"
 /><br /><br />



I don´t want to use width= int pxt or %...
I want to fill the text of the buttons dynamicly, more than 2, and then they should all have the same width like the largest...
Posted
Updated 10-Oct-11 2:07am
v2

use Width="20%" property

ASP.NET
<asp:button id="Button_Config_iPhone" runat="server" onclick="Button_CreateConfiguration_iPhone4" text="iPhone" tooltip="iPhone" xmlns:asp="#unknown">width="40%" /> 
</asp:button>
 
Share this answer
 
Comments
kuti, ger 10-Oct-11 7:54am    
is there something to size dynamic other buttons to have the same width like the largest? width="20%" is fix...
Try This...
Hope it will be helpful.

XML
<style type="text/css">
input[type=submit]
{
    width:80px;
}
</style>
 
Share this answer
 
Comments
kuti, ger 10-Oct-11 8:03am    
it is fix, also...
<asp:button id="buttton1" runat="server" onclick="Button_CreateConfiguration_iPhone4" text="iPhone" tooltip="iPhone" xmlns:asp="#unknown">width="40" />
</asp:button>

<asp:button id="button2" runat="server" onclick="Button_CreateConfiguration_iPhone4" text="iPhone" tooltip="iPhone" xmlns:asp="#unknown">width="40" /> 
</asp:button>
 
Share this answer
 
depending upon your need increase / decrease the value in style

C#
<style type="text/css">
.btns
{
  width:60%;
}
</style>



VB
<asp:Button ID="Button_Config_iPhone" runat="server" onclick="Button_CreateConfiguration_iPhone4" Text="iPhone" ToolTip="iPhone " CssClass="btns" 
 /><br /><br />

<asp:Button ID="Button_Config_WinMob" runat="server" onclick="Button_CreateConfiguration_WindowsMobile" Text="Windows Mobile Phone" ToolTip="Windows Mobile Phone" CssClass="btns"
 />
 
Share this answer
 
v2
Comments
hitech_s 10-Oct-11 8:07am    
if you want some buttons to be in different width create another class and assign the cssclass for those
XML
<style type="text/css">
#btns input[type=submit],input[type=button]
{
    width:80px;
}
</style>

<div id="btns">
<!--place buttons here -->
</div>
 
Share this answer
 
Comments
dreamz9 10-Oct-11 8:18am    
you may use .btns to use as css class

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900