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

No comments:

Post a Comment