Solved

enabling and disabling controls using radio button checked event

Posted on 2007-12-01
4
234 Views
Last Modified: 2010-04-21
HI Everyone
i am developing a web application in which user should select a mode by selecting a radio button.and appropriate contols should be visble .
my web applications has 3 modes
usermode
admin mode
mgr mode
when user selects "user mode",controls regarding user mode should be visble and all other controls should be disabled.and so on.
we are using old version of .net i.e 1.1
any code will help!!!
0
Comment
Question by:tag_k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
surajguptha earned 250 total points
ID: 20389484
Double click the radio button and in the code for the radio control add the statement
control.visible = true
or
control.visible = false
0
 

Author Comment

by:tag_k
ID: 20389557
coded same way but did not work
textbox1.visible=true
i have set visible propety of textbox1 to false.
0
 
LVL 63

Assisted Solution

by:Fernando Soto
Fernando Soto earned 250 total points
ID: 20389633
Hi tag_k;

After you have placed the three radio buttons on the Web Form, User, Admin and Manager set the following properties on the controls.

AutoPostBact = True        ' By default it is set to False
ID = rbWhatever
GroupName = Mode         ' So that the three radio work together or any other name you want to give it
Text = "String to display by radio button"

Create one event handler to handle the radio button CheckedChanged event and assign the other radio buttons in the group to the same event handler. Then use code like the sample in the event handler.

Fernando
private void SetMode_CheckedChanged(object sender, System.EventArgs e)
{
	RadioButton rb = (RadioButton)sender;
	switch (rb.ID)
	{
		case "rbUser":
			// Disable the Admin and Manager controls here
			break;
		case "rbAdmin":
			// Disable the User and Manager controls here 
			break;
		case "rbManager":
			// Disable the Admin and User controls here
			break;
	}
}

Open in new window

0
 

Author Closing Comment

by:tag_k
ID: 31412139
both together solved the problem
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
history of pages 7 52
Pdf not loading 2 39
SQL State HYT00. Timeout expired proplem 8 43
XML XDocument extract - Keeping a node list like a menu path 8 33
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question