Solved

enabling and disabling controls using radio button checked event

Posted on 2007-12-01
4
225 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
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
surajguptha earned 250 total points
Comment Utility
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
Comment Utility
coded same way but did not work
textbox1.visible=true
i have set visible propety of textbox1 to false.
0
 
LVL 62

Assisted Solution

by:Fernando Soto
Fernando Soto earned 250 total points
Comment Utility
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
Comment Utility
both together solved the problem
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now