Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Changing Textbox control properties

Author  Topic 

alpoor
Starting Member

29 Posts

Posted - 2005-06-15 : 13:59:38

Following code is giving syntax errors as I am trying to change properties of one of my form textbox control.What could be the problem


((TextBox)(childc)).ReadOnly="true"

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-06-15 : 15:31:27
It might be helpful to start things off by stating what language you are using; i.e., C# or VB.NET.

- Jeff
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-06-15 : 16:09:03
Looks to be C# considering the way this was casted to a textbox. Although he is missing a ';' so that prolly would bail out in C#.
Besides in VB.net you'd need to cast with CType or DirectCast.

What type is childc ?
Can you post code a bit before this and a bit after so we get the feel for what you are trying to do?


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2005-06-15 : 16:19:12
That property is for boolean values only. Remove your quote marks.

((TextBox)(childc)).ReadOnly = true;
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-06-15 : 16:26:04
Good catch Dustin


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

saglamtimur
Yak Posting Veteran

91 Posts

Posted - 2005-06-15 : 17:57:18
I think this question is related to your previous question (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=51131).

so its better to use like

if (childc is TextBox) {
((TextBox)(childc)).Enabled = true;
}

I think .Enabled property is what you need.
Go to Top of Page
   

- Advertisement -