This is a migrated thread and some comments may be shown as answers.
How to call OnItemClick on OnClientClick of RadPanelBar
6 Answers 184 Views
This is a migrated thread and some comments may be shown as answers.
Computer Surgeon
Top achievements
Rank 1
Computer Surgeon asked on 21 Jul 2009, 07:18 AM
Hi there,

               Do anybody know how to call the OnItemClick event of RadPanelBar during the OnClientClick of the same. i.e., Calling the server side method using OnClientClick of RadPanelBar

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 21 Jul 2009, 07:25 AM
Hello Computer Surgeon,

The server side event will be raised by default if you have subscribed to the ItemClick event and the NavigateUrl property of the clicked item is NOT set.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Computer Surgeon
Top achievements
Rank 1
answered on 21 Jul 2009, 07:52 AM
Hi there,
                In my application i'm using Master Content page relation.
1.) I have menuitems in master page.
2.) I'm in  a page say for example Finance.aspx
3.) i click on menu item in master page say Accounts.
4.) The PageLoad of Finance gets fired immediately. Where i' v couple of methods which should not fired on click of menu item because its take a while complete that and then only going to master page and then redirected to target page's (Accounts) Page_Load.

I know this falls on webforms LifeCycle . But it takes lot of time to redirect, nearly 10 to 15 sec. If i avoid pageload event of finance i will save 6 sec. (which consumed by finance pageload unnecessary while navigating to another page)

Objective is trying not to go to pageload of Finance on click Accounts menu in masterpage.

I'm trying to fire OnItemClick during the OnClientClick so that postback is set to false and directly navigate to target page (Accounts)
OnItemClick of RadPanelBar i do mandatory process. which is mandatory for the target (Accounts) pageload.

Thanks!

0
Computer Surgeon
Top achievements
Rank 1
answered on 21 Jul 2009, 08:21 AM
Please suggest me an idea to resolve this issue. Else give an idea to call the OnitemClick server side method while OnClientClick of RadPanelBar.
0
Atanas Korchev
Telerik team
answered on 21 Jul 2009, 08:24 AM
Hi Computer Surgeon,

Unfortunately I couldn't understand your requirements. Here is  how the ItemClick event of RadPanelBar works:

  1. First you need to subscribe to the ItemClick server side event
  2. Then make sure the NavigateUrl property of the item is not set. If it is set the item will navigate to that page instead of postback and raising ItemClick
  3. If you need to prevent the postback you can subscribe to the OnClientItemClicking event and cancel it. After cancelling RadPanelbar will not postback or navigate.

If you want to navigate from javascript after canceling postback you can use this code:

window.location.href = "http://www.example.com/test.aspx";

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Computer Surgeon
Top achievements
Rank 1
answered on 21 Jul 2009, 09:47 AM
I clearly undersand by default assigning/useing that OnItemClick property  it is possible of call the server method in master.cs page
I'm okay with cancel the postback during OnClientItemClicked . Explicitly i don't want to call OnItemClick. By adding this property
<telerik:RadPanelBar OnItemClick = "RadPanelBar_OnItemClick "/> 

I  'm in  a position to call the OnItemClick  using the following manner.

<telerik:RadPanelBar OnClientItemClicked = "OnClick "/> 

<script  language="javascript">
function OnClick(sender,args)
{
          // call a method in master page
         RadPanelBar_OnItemClick(sender,args);
}
</script>
My objective is to call RadPanelBar_OnItemClick(sender,args) using javscript
Is this way of approach is possible ?. If so how to call that server method placed in master.cs page using javascript.
All the above said are placed in Master_Page.master

kindly advice...

0
Computer Surgeon
Top achievements
Rank 1
answered on 21 Jul 2009, 10:29 AM
I tried like this master.cs
[System.Web.Services.WebMethod]
    public static void Radpanes_ItemClick(object sender, RadPanelBarEventArgs e)
    { // do some process }

master.master
<telerik:RadScriptManager EnablePageMethods="true" runat="server" ID="RadScriptManager1" />
<telerik:RadPanelBar OnClientItemClicked="OnClick" EnableEmbeddedSkins="false" CssClass="RadPanelBar_Outlook"
 Width="100%" ID="Radpanes" runat="server" >
<CollapseAnimation Duration="100" Type="None" />
<ExpandAnimation Duration="100" Type="None" />
</telerik:RadPanelBar>

function OnClick(sender, args)
{
   PageMethods.Radpanes_ItemClick(sender, args);
}
But  i'm  'PageMethods'  is undefined


function OnClick(sender, args)
{
   PageMethods.Radpanes_ItemClick(sender, args);
}




Asked by
Computer Surgeon
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Computer Surgeon
Top achievements
Rank 1
Share this question
or