This is a migrated thread and some comments may be shown as answers.

Add OnTabclick event from Codebehind

4 Answers 281 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Afo
Top achievements
Rank 1
Afo asked on 21 Oct 2008, 02:21 PM
Can you please show me how to add the 'OnTabClick' event from codebehind... I do not want to specify it at design time. Trying this did not work:

RadTabStrip1.Attributes.Add(

"OnTabClick", "RadTabStrip1_TabClick1");

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Oct 2008, 07:04 AM
Hello,

I suppose you want to add the click event of the RadTabStrip on the server side.
If thats the case, you can add the TabClickEvent handler from the properties of the RadTabStrip onto the server side.
cs:
 protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e) 
    { 
      //your code to perform an operation on click goes ere 
    } 

For more information on using server side events for TabStrip go through the following online demo link.
Server-Side Events

Thanks
Princy.
0
Afo
Top achievements
Rank 1
answered on 22 Oct 2008, 02:50 PM

Thanks...but I already have the event handler...How do I associate the event handler to the RadTab from the codebehind?

Currently I have this in my aspx page:

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1"  PerTabScrolling="true" OnTabClick="RadTabStrip1_TabClick1"

But I do not want to specify OnTabClick="RadTabStrip1_TabClick1"  in the aspx page but in the page_Load event in the codebehind.

 

0
Shinu
Top achievements
Rank 2
answered on 24 Oct 2008, 05:57 AM
Hi,

Try the following code snippet to achieve the desired scenario.

CS:
protected void Page_Load(object sender, EventArgs e) 
    { 
 
        RadTabStrip1.TabClick += new RadTabStripEventHandler(RadTabStrip1_TabClick); 
         
    } 
 
    void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e) 
    { 
         
    } 


Regards
Shinu.
0
Afo
Top achievements
Rank 1
answered on 24 Oct 2008, 02:42 PM
thanks, that worked.
Tags
TabStrip
Asked by
Afo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Afo
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or