Hi,
Is it possible to change the type of controls at run-time?
In other words I have a form with TextBoxes etc. on it. If the user only
has readonly privelages I was wondering if I could change the type of
control from TextBox to a Label or something and set the text
programatcially as I would the textbox.
If so how do I do it?
Thanks!
Ron 3 3237
Ron,
Once an object has been created, you can't change it's type. But you can
style a textbox that it will look like a label.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"RSH" <wa************ *@yahoo.comwrot e in message
news:Oz******** *****@TK2MSFTNG P04.phx.gbl...
Hi,
Is it possible to change the type of controls at run-time?
In other words I have a form with TextBoxes etc. on it. If the user only
has readonly privelages I was wondering if I could change the type of
control from TextBox to a Label or something and set the text
programatcially as I would the textbox.
If so how do I do it?
Thanks!
Ron
Check out this code sample at ASPNet101.com: http://aspnet101.com/aspnet101/aspne...?code=readonly
It specifically shows how to do what you're talking about.
--
David Wier
MVP/ASPInsider http://aspnet101.com http://aspexpress.com
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:O9******** ******@TK2MSFTN GP06.phx.gbl...
Ron,
Once an object has been created, you can't change it's type. But you can
style a textbox that it will look like a label.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"RSH" <wa************ *@yahoo.comwrot e in message
news:Oz******** *****@TK2MSFTNG P04.phx.gbl...
Hi,
Is it possible to change the type of controls at run-time?
In other words I have a form with TextBoxes etc. on it. If the user
only
has readonly privelages I was wondering if I could change the type of
control from TextBox to a Label or something and set the text
programatcially as I would the textbox.
If so how do I do it?
Thanks!
Ron
Good stuff...sometim es the solution is easier than you think.
I created a CSS class for readonly and editable and based on the credentials
I switched the class out on the fly. Seems to work pretty slick in my test.
Thanks for the ideas!
Ron
"RSH" <wa************ *@yahoo.comwrot e in message
news:Oz******** *****@TK2MSFTNG P04.phx.gbl...
Hi,
Is it possible to change the type of controls at run-time?
In other words I have a form with TextBoxes etc. on it. If the user only
has readonly privelages I was wondering if I could change the type of
control from TextBox to a Label or something and set the text
programatcially as I would the textbox.
If so how do I do it?
Thanks!
Ron This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roberto Castro |
last post by:
Hello!
I have been assigned for the first time an adp Access project and so
far I have managed to make the changes needed for some requirements.
However, I am struggling to find the place where the application
changes the color of the background of a textbox. Here the explanation
goes:
This is a form bound to an SQL view. The detail section has several
fields, one of them being a textbox of name "Type". I checked its
|
by: Andrew |
last post by:
I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.
However, as part of the build before delivering an update, I have to
remember to...
|
by: |
last post by:
Hi,all
I want to change Control's size&location in runtime ,(C#)
but i dont know how to do! :(so, can you provide me
with document about this.
my email: zhonghua@rinpak.com.cn zhonghua_1999@163.com
thank you in advance.
|
by: hugo batista |
last post by:
Hi
Sorry to crosspost, but i'm not knowing what should be the correct newsgroup
for this....
I have a web application which i want to show a windows forms user control
in my web form. (lets call this control userControl1)
I have no problem to do this, but when i use a COM / ActiveX control in
userControl1, and try to show it in IE, it fails, without any error. Any
|
by: Sky Sigal |
last post by:
I coming unglued... really need some help. 3 days chasing my tail all over
MSDN's documentation ...and I'm getting nowhere.
I have a problem with TypeConverters and
storage of expandableobjects to attributes in tags (think Style tag -> Style
object).
The problem that I am chasing is:
Html side:
| |
by: Leo |
last post by:
I created a user control which is some text contained in a HtmlTable.
I put this control into main form. I would like to have the ability to
move this control around in the main form. I think one way to do this
is to change the style of this control at runtime ("Left:xx px; Top:xx
px"). Another way is to move the HtmlTable in the control (i.e. change
the style of it). However I couldn't figure out how to let it work. At
design time, I...
|
by: Guadala Harry |
last post by:
In an ASCX, I have a Literal control into which I inject a
at runtime.
litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID);
This works great as long as the contains just client-side
HTML, CSS, etc.
What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
|
by: RG |
last post by:
For a Windows project in VB.NET 2003:
I need a Calendar that’s much larger than the MonthCalendar control in the
toolbox; it needs to fill the whole screen (at least approximately ). VB
won’t allow me to change the Size Height or Width Properties.
I see that you can size a Calendar control in a Web project all you like;
but I’m creating a Windows application project here.
I see that Size comes from System.Drawing.Size...
|
by: planetthoughtful |
last post by:
Hi All,
I have an ASP.NET page that displays a GridView control based on an
ObjectDataSource control.
I'm wondering if it's possible to base the ObjectDataSource in question
on a parameter query, with the ability to set the parameter value at
run time (in the Page_Load event, perhaps?)?
Basically, I'd like to display records in the GridView based on values
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |