4 Answers, 1 is accepted
0
Hello Stuart ,
I suggest that you try to achieve your goal at the client-side by using the following JS function in the panelbar's OnClientLoad event.
Regards,
Rosi
the Telerik team
I suggest that you try to achieve your goal at the client-side by using the following JS function in the panelbar's OnClientLoad event.
<form id="form1" runat="server"> |
<script type="text/javascript"> |
function FocusItem() |
{ |
setTimeout( |
function() |
{ |
var panelbar1 = <%=RadPanelbar1.ClientID %> |
var myitem = panelbar1.get_selectedItem(); |
for (var i=0; i<panelbar1.get_allItems().length; i++) |
{ |
if (panelbar1.get_allItems()[i].set_selected(true)) |
{ |
myitem.get_linkElement().scrollIntoView(true); |
} |
} |
}, 100); |
} |
</script> |
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px" EnableAJAX="false"> |
<telerik:RadPanelbar ID="RadPanelbar1" runat="server" OnItemClick="RadPanelbar1_ItemClick" Height="300px" Width="200px" ExpandMode="FullExpandedItem" OnClientLoad="FocusItem"> |
<Items> |
<telerik:RadPanelItem runat="server" Text="Root Option 1"> |
</telerik:RadPanelItem> |
<telerik:RadPanelItem runat="server" Text="Root Option 2"> |
</telerik:RadPanelItem> |
</Items> |
</telerik:RadPanelbar> |
</telerik:RadAjaxPanel> |
</form> |
Regards,
Rosi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Dan
Top achievements
Rank 1
answered on 12 May 2008, 08:35 AM
Rosi,
Thanks for the reply.
I'm a little confused by this test ...
if (panelbar1.get_allItems()[i].set_selected(true))
TBH, I'm a bit confused by the need for the loop too.
Why couldn't you just say...
?
--
Stuart
Thanks for the reply.
I'm a little confused by this test ...
if (panelbar1.get_allItems()[i].set_selected(true))
TBH, I'm a bit confused by the need for the loop too.
Why couldn't you just say...
var myitem = panelbar1.get_selectedItem(); |
myitem.get_linkElement().scrollIntoView(true); |
?
--
Stuart
0
Accepted
Hello Stuart,
I am sorry about this mistake.The line should be:
panelbar1.get_allItems()[i].get_selected() =true
Also,you are absolutely right that the code I sent you is redundant.
You can modify it like this:
Regards,
Rosi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I am sorry about this mistake.The line should be:
panelbar1.get_allItems()[i].get_selected() =true
Also,you are absolutely right that the code I sent you is redundant.
You can modify it like this:
<script type="text/javascript"> |
function FocusItem(sender,e) |
{ |
setTimeout( |
function() |
{ |
var panelbar1 = $find('<%=RadPanelBar1.ClientID %>'); |
var myitem = panelbar1.get_selectedItem(); |
if(myitem) |
myitem.get_linkElement().scrollIntoView(true); |
}, 100); |
} |
</script> |
Regards,
Rosi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Dan
Top achievements
Rank 1
answered on 12 May 2008, 01:25 PM
Thanks Rosi,
that's great.
--
Stuart
that's great.
--
Stuart