Ask a Question related to ASP.NET General, Design and Development.
-
Gandalf #1
Programmatically change width of texbox?
I thought this would be straightforward but it's not. How do I
programmatically reduce the width of a textbox by 20 pixels, say?
TextBox1.Width = TextBox1.Width - 20;
doesn't work.
Thanks in advance!
--
Gandalf Guest
-
Programmatically setting 100% width
Is there a way to set a width of 100% for dynamically created components? ... -
Programmatically change iis rights
Hi, Is it possible to programmatically (c# aspnet) change IIS rights on a file or a directory (allow write access on xml files, deny download... -
cannot change value of texbox w/in datagrid after first bind
I have a datagrid with the columns defined in the aspx <columns> <asp:TemplateColumn HeaderText="Hours"... -
Can I programmatically change width/height of column in edit mode
I have six bound columns. When I click Edit and go into edit mode, those six columns widths expand and force the browser to have a horizontal... -
How do I change the DataGrid column order programmatically?
I use a single datagrid to load several different types of data depending upon some user driven criteria. The AutoGenerateColumns property for the... -
Steve C. Orr, MCSD #2
Re: Programmatically change width of texbox?
Try this code:
TextBox1.Attributes.Add("width", 150)
--
I hope this helps,
Steve C. Orr, MCSD
[url]http://Steve.Orr.net[/url]
"Gandalf" <gandalf@sauron.com> wrote in message
news:OhZfUjiVDHA.1748@TK2MSFTNGP12.phx.gbl...> I thought this would be straightforward but it's not. How do I
> programmatically reduce the width of a textbox by 20 pixels, say?
>
> TextBox1.Width = TextBox1.Width - 20;
>
> doesn't work.
>
> Thanks in advance!
>
> --
>
>
>
Steve C. Orr, MCSD Guest
-
Gandalf #3
Re: Programmatically change width of texbox?
For that matter I could say:
TextBox1.Width=150;
which works, but that's not what I want.
--
"Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
news:uLVzw1iVDHA.1560@TK2MSFTNGP11.phx.gbl...> Try this code:
>
> TextBox1.Attributes.Add("width", 150)
>
> --
> I hope this helps,
> Steve C. Orr, MCSD
> [url]http://Steve.Orr.net[/url]
>
>
> "Gandalf" <gandalf@sauron.com> wrote in message
> news:OhZfUjiVDHA.1748@TK2MSFTNGP12.phx.gbl...>> > I thought this would be straightforward but it's not. How do I
> > programmatically reduce the width of a textbox by 20 pixels, say?
> >
> > TextBox1.Width = TextBox1.Width - 20;
> >
> > doesn't work.
> >
> > Thanks in advance!
> >
> > --
> >
> >
> >
>
Gandalf Guest
-
Natty Gur #4
Re: Programmatically change width of texbox?
are you looking for this ?
this.TextBox1.Width = Unit.Pixel((int)TextBox1.Width.Value - 20) ;
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Steve C. Orr, MCSD #5
Re: Programmatically change width of texbox?
It works but you don't want to use it? Would you prefer to use something
that doesn't work?
Well what is it that you want?
"Gandalf" <gandalf@sauron.com> wrote in message
news:eIWyVzjVDHA.1676@TK2MSFTNGP10.phx.gbl...> For that matter I could say:
>
> TextBox1.Width=150;
>
> which works, but that's not what I want.
Steve C. Orr, MCSD Guest
-
John Smith #6
Re: Programmatically change width of texbox?
Thanks Natty, that's what I want.
"Natty Gur" <natty@dao2com.com> wrote in message
news:OQkjPukVDHA.2328@TK2MSFTNGP12.phx.gbl...> are you looking for this ?
>
> this.TextBox1.Width = Unit.Pixel((int)TextBox1.Width.Value - 20) ;
>
> Natty Gur, CTO
> Dao2Com Ltd.
> 28th Baruch Hirsch st. Bnei-Brak
> Israel , 51114
>
> Phone Numbers:
> Office: +972-(0)3-5786668
> Fax: +972-(0)3-5703475
> Mobile: +972-(0)58-888377
>
> Know the overall picture
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
John Smith Guest
-
John Smith #7
Re: Programmatically change width of texbox?
The width of a textbox is not accessible thru the attributes collection. You
need to test your code before posting it! ;-)
"Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
news:uunoxWmVDHA.424@TK2MSFTNGP11.phx.gbl...> It works but you don't want to use it? Would you prefer to use something
> that doesn't work?
> Well what is it that you want?
>
>
> "Gandalf" <gandalf@sauron.com> wrote in message
> news:eIWyVzjVDHA.1676@TK2MSFTNGP10.phx.gbl...>> > For that matter I could say:
> >
> > TextBox1.Width=150;
> >
> > which works, but that's not what I want.
>
John Smith Guest
-
Steve C. Orr, MCSD #8
Re: Programmatically change width of texbox?
So now you're saying the code doesn't work?
You just said in your last message that it does work!
Make up your mind!
"John Smith" <JSmith@Phoney.com> wrote in message
news:%23FZyAipVDHA.2228@TK2MSFTNGP12.phx.gbl...You> The width of a textbox is not accessible thru the attributes collection.something> need to test your code before posting it! ;-)
>
> "Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
> news:uunoxWmVDHA.424@TK2MSFTNGP11.phx.gbl...> > It works but you don't want to use it? Would you prefer to use>> > that doesn't work?
> > Well what is it that you want?
> >
> >
> > "Gandalf" <gandalf@sauron.com> wrote in message
> > news:eIWyVzjVDHA.1676@TK2MSFTNGP10.phx.gbl...> >> > > For that matter I could say:
> > >
> > > TextBox1.Width=150;
> > >
> > > which works, but that's not what I want.
> >
>
Steve C. Orr, MCSD Guest
-
Gandalf #9
Re: Programmatically change width of texbox?
Your code doesn't work. Perhaps you should consider buying a book. I can
recommend a few if you like...
"Beginner's Guide to ASP.NET"
"ASP.NET for Dummies"
Those should get you started.
--
"Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
news:%23lHJ8rsVDHA.3220@tk2msftngp13.phx.gbl...> So now you're saying the code doesn't work?
> You just said in your last message that it does work!
> Make up your mind!
>
>
> "John Smith" <JSmith@Phoney.com> wrote in message
> news:%23FZyAipVDHA.2228@TK2MSFTNGP12.phx.gbl...> You> > The width of a textbox is not accessible thru the attributes collection.> something> > need to test your code before posting it! ;-)
> >
> > "Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
> > news:uunoxWmVDHA.424@TK2MSFTNGP11.phx.gbl...> > > It works but you don't want to use it? Would you prefer to use>> >> > > that doesn't work?
> > > Well what is it that you want?
> > >
> > >
> > > "Gandalf" <gandalf@sauron.com> wrote in message
> > > news:eIWyVzjVDHA.1676@TK2MSFTNGP10.phx.gbl...
> > > > For that matter I could say:
> > > >
> > > > TextBox1.Width=150;
> > > >
> > > > which works, but that's not what I want.
> > >
> > >
> >
>
Gandalf Guest
-
Gandalf #10
Re: Programmatically change width of texbox?
Note to Steve C. Orr, MCSD!!...
See answer below. It works.
--
"Natty Gur" <natty@dao2com.com> wrote in message
news:OQkjPukVDHA.2328@TK2MSFTNGP12.phx.gbl...> are you looking for this ?
>
> this.TextBox1.Width = Unit.Pixel((int)TextBox1.Width.Value - 20) ;
>
> Natty Gur, CTO
> Dao2Com Ltd.
> 28th Baruch Hirsch st. Bnei-Brak
> Israel , 51114
>
> Phone Numbers:
> Office: +972-(0)3-5786668
> Fax: +972-(0)3-5703475
> Mobile: +972-(0)58-888377
>
> Know the overall picture
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Gandalf Guest
-
Steve C. Orr, MCSD #11
Re: Programmatically change width of texbox?
Gee, for a person who can't even figure out how to set the width of a
textbox you aren't very humble now are you?
If only you were as wise as Gandalf the Grey.
The next time you post a question I shall promptly ignore it.
Natty's code is great for some situations depending on what you are trying
to do, but it only works with IE. Mine is cross browser.
In case you care, here's the working version of the code that I meant to
post:
MyTextBox.Attributes.Add("style", "width:350px;")
I'd explain to you how it works, but you probably wouldn't understand
anyway.
--
I hope this helps,
Steve C. Orr, MCSD
[url]http://Steve.Orr.net[/url]
"Gandalf" <gandalf@sauron.com> wrote in message
news:%23HCp47uVDHA.1984@TK2MSFTNGP11.phx.gbl...collection.> Your code doesn't work. Perhaps you should consider buying a book. I can
> recommend a few if you like...
>
> "Beginner's Guide to ASP.NET"
> "ASP.NET for Dummies"
>
>
> Those should get you started.
>
> --
>
> "Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
> news:%23lHJ8rsVDHA.3220@tk2msftngp13.phx.gbl...> > So now you're saying the code doesn't work?
> > You just said in your last message that it does work!
> > Make up your mind!
> >
> >
> > "John Smith" <JSmith@Phoney.com> wrote in message
> > news:%23FZyAipVDHA.2228@TK2MSFTNGP12.phx.gbl...> > > The width of a textbox is not accessible thru the attributes>> > You> > something> > > need to test your code before posting it! ;-)
> > >
> > > "Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
> > > news:uunoxWmVDHA.424@TK2MSFTNGP11.phx.gbl...
> > > > It works but you don't want to use it? Would you prefer to use> >> > > > that doesn't work?
> > > > Well what is it that you want?
> > > >
> > > >
> > > > "Gandalf" <gandalf@sauron.com> wrote in message
> > > > news:eIWyVzjVDHA.1676@TK2MSFTNGP10.phx.gbl...
> > > > > For that matter I could say:
> > > > >
> > > > > TextBox1.Width=150;
> > > > >
> > > > > which works, but that's not what I want.
> > > >
> > > >
> > >
> > >
> >
>
Steve C. Orr, MCSD Guest
-
Natty Gur #12
Re: Programmatically change width of texbox?
Gandalf Hi,
I don’t think Steve is desert this kind of behavior, He just want to
help you. Actually I learn my suggested answer from him...
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Gandalf #13
Re: Programmatically change width of texbox?
"Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
news:OqanDCxVDHA.208@tk2msftngp13.phx.gbl...It's amazing what you can come up with if you work for over 24 hours on a> Gee, for a person who can't even figure out how to set the width of a
> textbox you aren't very humble now are you?
> If only you were as wise as Gandalf the Grey.
> The next time you post a question I shall promptly ignore it.
>
> Natty's code is great for some situations depending on what you are trying
> to do, but it only works with IE. Mine is cross browser.
>
> In case you care, here's the working version of the code that I meant to
> post:
problem. Well done Steve, you're a champ! No seriously, you are. Honestly.
Really.
Gandalf Guest
-
Unregistered #14
Re: Programmatically change width of texbox?
Re: Programmatically change width of texbox
Unregistered Guest



Reply With Quote

