Hi All,
I've been trying to set my tab width on client side but its not working. There is no error but changes are not being applied. This is based on Clients screen resolution. 1024x768 and below will be 150px tab width, higher than 1024x768 300px tab width.
Heres my code
Thanks in advance,
Rj
I've been trying to set my tab width on client side but its not working. There is no error but changes are not being applied. This is based on Clients screen resolution. 1024x768 and below will be 150px tab width, higher than 1024x768 300px tab width.
Heres my code
var Mytab;
function OnClientLoad(sender)
{
Mytab = sender;
var scrW = screen.width;
var scrH = screen.height;
var val;
if (scrW <= 1024){
val = "150px";
}else{
val = "300px";
}
for (var i = 0; i < Mytab.get_allTabs().length; i++)
{
Mytab.get_allTabs()[i].width = val;
}
}
<telerik:RadTabStrip ID="MyTab" runat="server" EnableEmbeddedSkins="False" OnClientLoad="OnClientLoad" .....
Thanks in advance,
Rj
7 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 18 Jul 2013, 10:46 AM
Hi RJ,
Try the following JavaScript code in your
JavaScript:
Thanks,
Princy.
Try the following JavaScript code in your
OnClientLoad event.
JavaScript:
Mytab.get_allTabs()[0]._element.style.width = val;
Thanks,
Princy.
0
RJ
Top achievements
Rank 1
answered on 18 Jul 2013, 12:17 PM
Thanks a lot Princy it works!
Though after testing it in different client resolution, it seems like I need to change not just the width but the css of the tab. Is it possible to do that? Thanks again
Though after testing it in different client resolution, it seems like I need to change not just the width but the css of the tab. Is it possible to do that? Thanks again
0
Accepted
Princy
Top achievements
Rank 2
answered on 19 Jul 2013, 06:05 AM
Hi RJ,
I guess you want to set a CSS class for the respective tabs. Please try the following JavaScript code.
JavaScript:
CSS:
Thanks,
Princy.
I guess you want to set a CSS class for the respective tabs. Please try the following JavaScript code.
JavaScript:
for
(
var
i = 0; i < Mytab.get_allTabs().length; i++) {
Mytab.get_allTabs()[i].set_cssClass(
"style1"
);
}
CSS:
<style type=
"text/css"
>
.style
1
{
width
:
150px
;
}
</style>
Thanks,
Princy.
0
RJ
Top achievements
Rank 1
answered on 20 Jul 2013, 04:14 PM
Thanks so much Princy..
I just wonder where did you find those javascript property. Cant find those on http://www.telerik.com/help/aspnet-ajax/introduction.html
I just wonder where did you find those javascript property. Cant find those on http://www.telerik.com/help/aspnet-ajax/introduction.html
0
0
Hello RJ,
Plamen
Telerik
The get_allTabs() method is shown in this help topic. It seems that the set_cssClass is not described in the RadTab object article but it is typical for RadControls and almost all of them have one. We will add it as soon as we can.
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
RJ
Top achievements
Rank 1
answered on 23 Jul 2013, 07:13 AM
Thanks Plamen