enabling and disabling controls using radio button checked event

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!!!
tag_kAsked:
Who is Participating?
 
surajgupthaConnect With a Mentor Commented:
Double click the radio button and in the code for the radio control add the statement
control.visible = true
or
control.visible = false
0
 
tag_kAuthor Commented:
coded same way but did not work
textbox1.visible=true
i have set visible propety of textbox1 to false.
0
 
Fernando SotoConnect With a Mentor RetiredCommented:
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
 
tag_kAuthor Commented:
both together solved the problem
0
All Courses

From novice to tech pro — start learning today.