Showing posts with label disable. Show all posts
Showing posts with label disable. Show all posts

Wednesday, March 28, 2012

Tab and Enable

Hello

I′m using the tab component and i would like to know how can i disable all the controls inside a tab automatically avoding editing.

Best regards,

Borja

could you not just loop through all the controls in the tabcontainer?

for each ctl as Control in tabcontainer.controls

ctl.enable=false

next

?


What′s the difference between enable and visible in the tab?


I believe enable=false will just gray out the tab and make it unselectable, where as visible=false will make it disappear completely.


Put all the controls you want to disable in a panel for example, and disable the panel? All the controls inside it will be disabled..


As he said, disabled controls (enabled=false) will be grayed out, while controls with visible=false will not be visible at all for the user. Which is also not the same as using style="display:none;" nor style="visibility:hidden;"... If you are gonna toggle between hiding and showing stuff, I recommend the last techniques as you can show/hide simply with css. (don't use style="", but rather define it in css if possible)

Tab Control - Enable/Disable Tab on Client

I'm using the AJAX Toolkit TabContainer control and would like to enable/disable tabs on the clientside. I have tried document.getElementById('MyTabContainer').get_tabs()[1].set_enabled(true), but I get the error "Object does not support this property or method." Just to try to capture the appropriate object, I added the OnClientActiveTabChanged="switchTab" attribute to my TabContainer. Then, in JavaScript I wrote a switchTab function: function switchTab(sender, e){ ... } Thesender passed into the switchTab function is the actual TabContainer object I need, and from that I can enable/disable tabs. My problem is I can't figure out how to retrieve the TabContainer object other than capturing the object when sent into the switchTab routine. Any ideas?

Finally solved my own problem, and it was right there in the sample Tab application in the Control Toolkit: http://ajax.asp.net/ajaxtoolkit/Tabs/Tabs.aspx. I was able to find the object I needed in JavaScript using the $find method, as similarly done in the demo with the following snippet:

function ToggleHidden(value) {
$find('ctl00_SampleContent_Tabs').get_tabs()[2].set_enabled(value);
}

Monday, March 26, 2012

Tab control disabling tab from code-behind

Hi i think i found a bug.

When i disable a tab from the code behind using following code the text of the tab stays on the screen.

Permits_tab.Enabled =

False

Permits_tab.Visible =

False

So instead i wrote the following code

ScriptManager.RegisterStartupScript(Main_Tabs,

Me.GetType,"removePermitTab","setTimeout(""$find('Main_Tabs').get_tabs()[1].set_enabled(true);"",100);",True)

it basically disables it after the object is build but there's a catch. I had to use timeout to do this because main tab is not built at the place of the code is placed. So if the page loads slow the timeout will run early if the page loads fast enough then the client will see the tab disappear from the tab and get confused.

It's working for me... Sort of.. I just set visible=false without setting enabled. The thing is, the nice gradient tab disappears just for that tab, but the headertext remains...
thats not working actually if you disable from client side using jscript no headertext no nothing shows up :P :)

Actually there is one much simpler solution ;)

Permits_tab.visible = false;

Permits_tab.headertext=""

And this works perfectly for me.


That solution is so sexy it brought tears to my eyes. Yes
HEYYYY thats cheating, hehehehe but works like a charmStick out tongueBig SmileBig Smile

Wednesday, March 21, 2012

TabContainer disable problem

I have a tabcontainer. And I want to implement a feature: when the first time I load the page, it's diabled, but after I elect a checkbox, it will be enabled.

So I have code in the my page file like below:

<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" enabled="false">

And in my javascript file, I get the tabcontainer, and set its disable property to false. Yes, I can see in the page, the control is enabled (not gray out), but I cannot operate on any control inside it. For instance, the tab contains a textbox, but whatever what I do, the textbox cannot get focus. Any opinion on that?

Disabling the tab container will also disable all controls inside of it (this is the correct behavior). I'm guessing you want to disable clicking of the tabs until after the checkbox has been clicked. I suggest exposing a new public property to disable the clicking of the tabs.


Yup, if disable the tab it should also disable all controls contained by the tab. But I think after enabling the container, all controls in the tab should be editable, like Winform does.

bluemistonline:

Disabling the tab container will also disable all controls inside of it (this is the correct behavior). I'm guessing you want to disable clicking of the tabs until after the checkbox has been clicked. I suggest exposing a new public property to disable the clicking of the tabs.

What do i have to do, to expose a new property for the tab? I need the functionality to disable a tab (greyed out) and to add tooltips for a tab.

Can somebody show me an example?


Can somebody help me with this issue, please. Release date is comming closer and closerBig Smile