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

Linkbutton in tab template

7 Answers 192 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Scott Rakestraw
Top achievements
Rank 1
Scott Rakestraw asked on 18 Jul 2008, 05:06 PM
I have a linkbutton in my tab template but when I click on it no postback event is fired.  Is there anything special I need to do to enable this?

7 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 21 Jul 2008, 12:05 PM
Hi Scott Rakestraw,

I've attached a sample page which demonstrates the requested capability.

RadTabStrip currently consumes the click event of the link button due to DOM event bubbling. You need a JavaScript routine to prevent that:

    <script type="text/javascript"
        function stopPropagation(e) 
        { 
            e.cancelBubble = true
            if (e.stopPropagation) 
                e.stopPropagation();     
        } 
    </script> 
    <telerik:RadTabStrip runat="server" ID="RadTabStrip1"
        <TabTemplate> 
            <asp:LinkButton runat="server" ID="LinkButton1" Text='<%# DataBinder.Eval(Container, "Text") %>'  
            OnClick="LinkButton1_OnClick"
OnClientClick
="stopPropagation(event)"></asp:LinkButton> 
        </TabTemplate> 
        <Tabs> 
            <telerik:RadTab Text="Tab1"></telerik:RadTab> 
            <telerik:RadTab Text="Tab2"></telerik:RadTab> 
            <telerik:RadTab Text="Tab3"></telerik:RadTab> 
        </Tabs> 
    </telerik:RadTabStrip> 

Best wishes,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Geert
Top achievements
Rank 1
answered on 25 Sep 2008, 02:22 PM
Hello,

ok the javascript works nice. But I like to take it up a level. Is it possible to ajaxify this linkbutton with a proxymanager in code behind??

already tried it out but without succes.

This is really keeping us occupied.

thanks in advance

The SOFIM-team (Belgium)
0
Atanas Korchev
Telerik team
answered on 25 Sep 2008, 02:24 PM
Hello Geert,

Have you tried creating the AjaxSettings from codebehind? You need to pass a reference to the specific linkbutton. You can get one using the FindControl method of the RadTab object.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Geert
Top achievements
Rank 1
answered on 25 Sep 2008, 02:38 PM
Hello,

Yes I do, like this in the PageLoad:

if

(RadTabStrip1.SelectedIndex == 0)
{
ImageButton btnRefresh = (ImageButton)RadTabStrip1.Tabs[0].FindControl("btnRefresh");
if (btnRefresh != null)
{
M
etisCollectionManager.AjaxSettings.AddAjaxSetting(btnRefresh, tvDossiers);
MetisCollectionManager.AjaxSettings.AddAjaxSetting(btnRefresh,
pnlCollectionEmployee_Updatable);
}
}

<

telerik:RadTab>
<TabTemplate>
<asp:Label ID="lnkSelection" runat="server" Text="Selectieboom"></asp:Label>
<asp:ImageButton runat="server" onmouseover="style.cursor='pointer'" AlternateText="refresh collection"Width="10px" OnClientClick="stopPropagation(event)" Height="10px" ToolTip="refresh collection" ID="btnRefresh" OnClick="RefreshTreeViewAndCollection" ImageUrl="~/Images/refresh.jpg" />
</TabTemplate>
</telerik:RadTab>

Any IDs?

The SOFIM-team

0
Geert
Top achievements
Rank 1
answered on 25 Sep 2008, 02:52 PM
Hello,

We also discovered a short error before starting the postback and it goes like this:

this._postBackSettings.async is null or not an object

maybe this can help??
 
0
Atanas Korchev
Telerik team
answered on 25 Sep 2008, 02:53 PM
Hi Geert,

Please try removing the OnClientClick attribute of the imagebutton and pasting this javascript below your radtabstrip declaration:

    <script type="text/javascript">
    var click = Telerik.Web.UI.RadTabStrip.prototype._click;
    Telerik.Web.UI.RadTabStrip.prototype._click = function (e)
    {
        if (e.target.tagName.toLowerCase() =="input")
            return;
           
        click.apply(this, arguments);
    }
    </script>

Sincerely yours,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Geert
Top achievements
Rank 1
answered on 25 Sep 2008, 03:05 PM
Hello,

this solutions seems to work allthough it looks like serious kind-a-hacking. We will try to solve it out and try to understand.

For now thanks a lot.

PS I'm trying to open a radwindow from an imagebutton next to this one in the tab which when closed will also update several stuff,...
I'll first try it myself but maybe it's good to mentally prepare yourself for new questions. :) hèhè

thanks from the SOFIM-team (Belgium)


Tags
TabStrip
Asked by
Scott Rakestraw
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Geert
Top achievements
Rank 1
Share this question
or