Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 C C# C#4.0
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 25-Jul-12 19:25pm
Edited 25-Jul-12 20:08pm
v2
Comments
OriginalGriff at 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 at 27-Jul-12 15:59pm
   
WPF, Silverlight, Windows Forms, ASP.Net or what?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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:
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.
  Permalink  
Comments
Espen Harlinn at 27-Jul-12 16:03pm
   
Good points :-D
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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...
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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?
  Permalink  
Comments
Sandeep Mewara at 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 at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 27 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100