Setting textbox width from server side

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Setting textbox width from server side

    Hi

    I'm trying to set the width of a textbox from the server side. I've tried

    dim tb as new Textbox()
    tb.width = "80"

    but this gives me an error saying that the
    "value of string cannot be converted to 'System.Web.UI.WebControls.Unit'"

    How would I set the width? I've also tried

    tb.width.pixels(80) and that does not seem to change the width.

    Thanks
    Harry




    Harry Guest

  2. Similar Questions and Discussions

    1. Client-Side Validation of asp:TextBox with Javascript
      Hi - I'm trying to do client-side validation of the text in a Asp.Net textbox control using javascript. My page has the following: <form...
    2. Programmatically setting 100% width
      Is there a way to set a width of 100% for dynamically created components? ...
    3. ASP:TextBox Width doesn't work with Firefox 1.0
      I created a Web Form in VS2003 with some ASP:TextBox components on it. In Windows with IE6, everything looks great. However, when I tested the...
    4. How to stop font width expanding when textbox is resized
      How to stop font width expanding when textbox is resized Hi, I am new to this Forum and to Fireworks MX. I am trying to create buttons and...
    5. runat="server"....a simple html textbox or a webform server textbox...that is the question.
      I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the...
  3. #2

    Default Re: Setting textbox width from server side

    dim tb as new Textbox()
    tb.width = system.web.ui.webcontrols.unit.pixel(80)


    "Harry" <NoSpam_shao_lin_monk@yahoo.com> wrote in message
    news:#MDPVe$ODHA.1624@tk2msftngp13.phx.gbl...
    > Hi
    >
    > I'm trying to set the width of a textbox from the server side. I've tried
    >
    > dim tb as new Textbox()
    > tb.width = "80"
    >
    > but this gives me an error saying that the
    > "value of string cannot be converted to 'System.Web.UI.WebControls.Unit'"
    >
    > How would I set the width? I've also tried
    >
    > tb.width.pixels(80) and that does not seem to change the width.
    >
    > Thanks
    > Harry
    >
    >
    >
    >

    Onur Bozkurt Guest

  4. #3

    Default Re: Setting textbox width from server side

    Thanks!

    "Onur Bozkurt" <onur.bozkurt@softhome.net> wrote in message
    news:uXiJaj$ODHA.1552@TK2MSFTNGP10.phx.gbl...
    > dim tb as new Textbox()
    > tb.width = system.web.ui.webcontrols.unit.pixel(80)
    >
    >
    > "Harry" <NoSpam_shao_lin_monk@yahoo.com> wrote in message
    > news:#MDPVe$ODHA.1624@tk2msftngp13.phx.gbl...
    > > Hi
    > >
    > > I'm trying to set the width of a textbox from the server side. I've
    tried
    > >
    > > dim tb as new Textbox()
    > > tb.width = "80"
    > >
    > > but this gives me an error saying that the
    > > "value of string cannot be converted to
    'System.Web.UI.WebControls.Unit'"
    > >
    > > How would I set the width? I've also tried
    > >
    > > tb.width.pixels(80) and that does not seem to change the width.
    > >
    > > Thanks
    > > Harry
    > >
    > >
    > >
    > >
    >
    >

    Harry Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139