Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear friends,

I have a project in Tab control.

I have three tabs in that Tab Control named (First_Tab, Second_Tab, Third_Tab). In that same form i have three Buttons named (First_Button, Second_Button, Third_Button).

I need, When i click the First_Button, ---> From the Tab Control, First_Tab will Enable and others looks Disable format user can't do any change in other tabs (2,3 tabs) except First_Tab.

When i click the Second_Button, ---> From the Tab Control, Second_Tab will Enable and others looks Disable format user can't do any change in other tabs (1,3 tabs) except Second_Tab.


When i click the Third_Button, ---> From the Tab Control, Third will Enable and others looks Disable format user can't do any change in other tabs (1,2 tabs) except Third_Tab.


Please give some ideas.........


[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 25-Jul-12 19:08pm
v2
Comments
OriginalGriff 26-Jul-12 1:08am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
Espen Harlinn 27-Jul-12 15:59pm    
WPF, Silverlight, Windows Forms, ASP.Net or what?

What a horrible way to do things!

If your users have met tab pages before (and they probably have, windows uses them a lot) then they will expect to click on a tab to select the page, not a button outside the tab. Equally, they will not expect other tabs to be disabled. So why are you using a tab control in the first place, if all you are going to do is make the familiar work in a totally different and confusing manner? That is bad for you app, because it means that users have to learn a new behaviour specifically for you, and that is in contrast to the rest of their use of the system.

Instead, if you must do this, then use a set of panels, and make the appropriate panel visible when you press your button, the the others invisible.

If you instist on this, you can set the active tab page very easily - just set the TabControl.SelectedTab property to the appropriate TabPage:
C#
tabControl1.SelectedTab = tabPage2;
But you can't easily disable tab pages - they will still be clickable via the tab itself. So you will need to put a panel on each tab page, and enable or disable that to disable it's contents.
 
Share this answer
 
Comments
Espen Harlinn 27-Jul-12 16:03pm    
Good points :-D
It sounds like you are creating some kind of wizard[^], and haven't quite figured out that it's a good idea to separate presentation logic from the datamodel. Have a look at Model–view–controller[^].

You can provide multiple views into your datamodel, and ASP.NET User Controls[^], Windows Form User Control[^], or How to Create a WPF User Control & Use It in a WPF Application ( C# )[^] - depending on the technology you are using - can be displayed as dictated be the state of your program/module.

It does sound like an Event-driven finite-state machine[^] would be useful.

Best regards
Espen Harlinn
 
Share this answer
 
Hi
Please try this examples,then you will get the idea

A Simple ASP.NET Tab Control Using the MultiView control[^]

Tab control for ASP.NET Applications[^]

Thanks
Shiju
 
Share this answer
 
What is this:
Disable other tabs except current tab in tab control C#[^]

I dont think you are going to get any different answers this time.

And in the future dont re-post questions, use the Improve Question button instead. It will be treated as a new question if you do. FYI: Re-post and not using Google is not popular here...
 
Share this answer
 
v2
Actually, I have a kind of similar issue...
I have a form with about 15 tabs...
When the page loads, a data store is consulted, and data flows into the different tabs....
Sometimes, a tab will NOT contain any data.... (Depends on the selected data set... ya never know)
So, in cases where some tabs wind up with nothing IN them, I want to grey out/disable the tab in question

The user will be able to see, at a glance, which tabs have data, which do not, and can click the tabs that have data, to go "deeper" into the application....

So, although the OP's case may not be the best, the Question asked remains germaine...

I can't find a way to disable a tab page.... Is this not possible?
 
Share this answer
 
Comments
Sandeep Mewara 27-Jul-12 15:27pm    
This is not an answer. Please use 'Have a Question or Comment' link to respond to an answer. It will notify answerer of your comment such that he can come back and reply.
lewax00 27-Jul-12 15:51pm    
You'll get better results asking your own question, no one is going to check the solutions section of a question for new questions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900