Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Set width of button


Message #1 by "Wouzer Wilco" <inhumanoid@y...> on Mon, 12 Nov 2001 15:50:22
How do I get and set the width of a asp:button ? I tried:



Dim intWidth As Integer

intWidth = btn.Width

intWidth = intWidth+1

btn.Width = intWidth



this gives me an error
Message #2 by "Al LeMay" <alemay@d...> on Mon, 12 Nov 2001 08:21:11 -0800
Why don't you just do:



Btn.Width =3D btn.Width + 1



You don't need that many statements.  Also where does this code live, in

the page_load() function or another place?



Al LeMay

Virtuoso, Ltd.

Quality Assurance Manager

alemay@d...







-----Original Message-----

From: Wouzer Wilco [mailto:inhumanoid@y...]

Sent: Monday, November 12, 2001 7:50 AM

To: ASP+

Subject: [aspx] Set width of button





How do I get and set the width of a asp:button ? I tried:



Dim intWidth As Integer

intWidth =3D btn.Width

intWidth =3D intWidth+1

btn.Width =3D intWidth



this gives me an error

---

VBug Winter Conference 2001



Open Forum:  Dan Appleman will be hosting an open

forum at The .NET Developer's Conference on

29th November 2001.  The session will give

developers the chance to discuss and question

Dan on his experience with the .NET environment. 

Dan has been programming Visual Basic since the

alpha version 1.0.  And with over 10 years

Visual Basic experience is well qualified to

help you on your road to being a .NET Guru.



http://www.vbug.co.uk/redirect.asp?url=3D39&id=3D17



---

You are currently subscribed to

aspx as: alemay@d...


$subst('Email.Unsub')

Message #3 by "Wouzer Wilco" <inhumanoid@y...> on Mon, 12 Nov 2001 19:11:33
It's under the btn_click..

If I apply your way I get the following error:



CS0019: Operator '+' cannot be applied to operands of 

type 'System.Web.UI.WebControls.Unit' and 'int'
Message #4 by "Samuel Engelman" <samuel_engelman@p...> on Mon, 12 Nov 2001 16:12:33 -0500
The reason you are getting the error is because the value of button.width is an

object of tye Unit.



This code works





Button1.Width = Unit.Parse((Int16.Parse(Button1.Width.Value.ToString()) +

100).ToString())

(C#)









|--------+--------------------------------->

|        |   "Wouzer Wilco"                |

|        |   <inhumanoid@y...>        |

|        |                                 |

|        |                                 |

|        |   Monday November 12, 2001 02:11|

|        |   PM                            |

|        |   Please respond to "ASP+"      |

|        |                                 |

|--------+--------------------------------->

  >------------------------------------------------------------|

  |                                                            |

  |      To:                                  "ASP+"           |

  |       <aspx@p...>                                  |

  |      cc:                                                   |

  |      Subject: [aspx] RE: Set width of button               |

  >------------------------------------------------------------|









It's under the btn_click..

If I apply your way I get the following error:



CS0019: Operator '+' cannot be applied to operands of

type 'System.Web.UI.WebControls.Unit' and 'int'

---

VBug Winter Conference 2001



Open Forum:  Dan Appleman will be hosting an open

forum at The .NET Developer's Conference on

29th November 2001.  The session will give

developers the chance to discuss and question

Dan on his experience with the .NET environment.

Dan has been programming Visual Basic since the

alpha version 1.0.  And with over 10 years

Visual Basic experience is well qualified to

help you on your road to being a .NET Guru.



http://www.vbug.co.uk/redirect.asp?url=39&id=17



---

You are currently subscribed to

aspx as: Samuel_Engelman@p...


$subst('Email.Unsub')








  Return to Index