8 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 21 Dec 2011, 06:59 AM
0
Kevin
Top achievements
Rank 1
answered on 02 Feb 2012, 07:08 PM
Hello,
This is exactly what I was looking for except I'm having a problem. My tab names are not showing up.
They are added server side in the on load event. All I see is a blank tab with the "X" close button. Any idea how to have the tab names show up?
Thanks!
Kevin
This is exactly what I was looking for except I'm having a problem. My tab names are not showing up.
They are added server side in the on load event. All I see is a blank tab with the "X" close button. Any idea how to have the tab names show up?
protected
void
Page_Load(
object
sender, System.EventArgs e)
{
if
(!Page.IsPostBack)
{
AddTab(
"Customers"
);
AddPageView(RadTabStrip1.FindTabByText(
"Customers"
));
AddTab(
"Orders"
);
AddTab(
"Products"
);
}
}
Thanks!
Kevin
0
Princy
Top achievements
Rank 2
answered on 03 Feb 2012, 07:29 AM
Hello,
Try the following code snippet.
C#:
Thanks,
princy.
Try the following code snippet.
C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
RadTab tab =
new
RadTab();
tab.Text =
"tab"
;
tab.ImageUrl =
"~/Images/button_edit_grey.gif"
;
RadTabStrip1.Tabs.Add(tab);
}
}
Thanks,
princy.
0
Hi Kevin,
When you use templates you have to call the DataBind() method of RadTabStrip on each Page_Load event in order for the binding expressions to work and show the text.
Greetings,
Bozhidar
the Telerik team
When you use templates you have to call the DataBind() method of RadTabStrip on each Page_Load event in order for the binding expressions to work and show the text.
Greetings,
Bozhidar
the Telerik team
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 their blog feed now
0
Johnny
Top achievements
Rank 2
answered on 20 Feb 2012, 04:23 AM
hi i don't want to show close button for all tab
i need to hide the close button for First tab how to acive this?
and
i remove the tab and related pageview from client side
how do i add it back from client side
i add it back from client side using following code but the template doesn't show
am i missing something
i need to hide the close button for First tab how to acive this?
and
i remove the tab and related pageview from client side
how do i add it back from client side
i add it back from client side using following code but the template doesn't show
am i missing something
var tabStrip = $find("ctl00_ContentPlaceHolder1_PageTab");
var multiPage = $find("ctl00_ContentPlaceHolder1_MultiPage");
var tab = tabStrip.findTabByText("Search");
var pageView = tab.get_pageView();
tabStrip.get_tabs().add(tab);
multiPage.get_pageViews().add(pageView);
0
Hello Johnny,
To answer your first question, aside from the global template that you set on RadTabStrip, you can also assign templates to tabs individually, overriding the global template for that tab. Using the TabStrip from the demo mentioned earlier, here's how you can set the first node so that it doesn't have the delete button:
And when you add new tabs, you always have to call the DataBind() method from the server, otherwise the databinding expressions wouldn't work. For this purpose you can use RadAjaxManager to make a partial postback and rebind the TabStrip whenever you add a new tab.
Kind regards,
Bozhidar
the Telerik team
To answer your first question, aside from the global template that you set on RadTabStrip, you can also assign templates to tabs individually, overriding the global template for that tab. Using the TabStrip from the demo mentioned earlier, here's how you can set the first node so that it doesn't have the delete button:
<
telerik:RadTabStrip
runat
=
"server"
ID
=
"RadTabStrip1"
Orientation
=
"HorizontalTop"
Skin
=
"WebBlue"
SelectedIndex
=
"0"
MultiPageID
=
"RadMultiPage1"
>
<
TabTemplate
>
<
div
class
=
"textWrapper"
>
<%# DataBinder.Eval(Container, "Text") %>
</
div
>
<
span
class
=
"ie6shim"
></
span
>
<
img
src
=
"delete.gif"
alt
=
"delete"
onclick
=
"deleteTab('<%# DataBinder.Eval(Container, "
Text") %>')" />
</
TabTemplate
>
<
Tabs
>
<
telerik:RadTab
Text
=
"Products"
>
<
TabTemplate
>
<
div
class
=
"textWrapper"
>
<%# DataBinder.Eval(Container, "Text") %>
</
div
>
<
span
class
=
"ie6shim"
></
span
>
</
TabTemplate
>
</
telerik:RadTab
>
<
telerik:RadTab
Text
=
"Services"
>
</
telerik:RadTab
>
<
telerik:RadTab
Text
=
"Corporate"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
And when you add new tabs, you always have to call the DataBind() method from the server, otherwise the databinding expressions wouldn't work. For this purpose you can use RadAjaxManager to make a partial postback and rebind the TabStrip whenever you add a new tab.
Kind regards,
Bozhidar
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Johnny
Top achievements
Rank 2
answered on 21 Feb 2012, 03:03 AM
hi Bozhidar
i don't want page postback on tab closingso i decided to hide 2nd and 3rd tab while page loading
In the AjaxLoadingPanel RequestEnd event i check the Hidden Variable Value then show or Hide the 2nd and 3rd Tab
my problem is when i close the 2nd tab by clicking close btn and select First tab by client side tab.set_selected(true); the fisrt tab
doesn't selected how to achive this
Page_Load Code
AjaxLoading Panel OnRequestEnd event code
This is my coseTab Code
i don't want page postback on tab closingso i decided to hide 2nd and 3rd tab while page loading
In the AjaxLoadingPanel RequestEnd event i check the Hidden Variable Value then show or Hide the 2nd and 3rd Tab
my problem is when i close the 2nd tab by clicking close btn and select First tab by client side tab.set_selected(true); the fisrt tab
doesn't selected how to achive this
Page_Load Code
var tabStrip = $find("ctl00_ContentPlaceHolder1_PageTab");
var multiPage = $find("ctl00_ContentPlaceHolder1_MultiPage");
var tab = tabStrip.findTabByText("Search");
var pageView = tab.get_pageView();
tab.set_visible(false);
pageView.hide();
// tabStrip.get_tabs().remove(tab);
// multiPage.get_pageViews().remove(pageView);
tab = tabStrip.findTabByText("Viewer");
pageView = tab.get_pageView();
// tabStrip.get_tabs().remove(tab);
// multiPage.get_pageViews().remove(pageView);
tab.hide();
pageView.hide();
AjaxLoading Panel OnRequestEnd event code
var tabStrip = $find("ctl00_ContentPlaceHolder1_PageTab");
var multiPage = $find("ctl00_ContentPlaceHolder1_MultiPage");
tabStrip.trackChanges();
var tab = tabStrip.findTabByText("Search");
var pageView = tab.get_pageView();
if ($("#ContentPlaceHolder1_ResultTabVisibleHidden").attr("value") == "1") {
// tabStrip.get_tabs().add(tab);
// multiPage.get_pageViews().add(pageView);
tab.set_visible(true);
pageView.show();
}
else {
// tabStrip.get_tabs().remove(tab);
// multiPage.get_pageViews().remove(pageView);
tab.set_visible(false);
pageView.hide();
}
var tab = tabStrip.findTabByText("Viewer");
var pageView = tab.get_pageView();
if ($("#ContentPlaceHolder1_ViewerTabVisibleHidden").attr("value") == "1") {
// tabStrip.get_tabs().add(tab);
// multiPage.get_pageViews().add(pageView);
tab.show();
pageView.show();
}
else {
// tabStrip.get_tabs().remove(tab);
// multiPage.get_pageViews().remove(pageView);
tab.hide();
pageView.hide();
}
tabStrip.commitChanges();
function CloseTab(tabText) {
var tabStrip = $find("ctl00_ContentPlaceHolder1_PageTab");
var multiPage = $find("ctl00_ContentPlaceHolder1_MultiPage");
var tab = tabStrip.findTabByText(tabText);
var pageView = tab.get_pageView();
var tabToSelect = tabStrip.findTabByText("Mail");
tab.set_visible(false);
pageView.hide();
if (tabText == "Search") {
$("#ContentPlaceHolder1_ResultTabVisibleHidden").attr("value", "0");
}
else if (tabText == "Viewer") {
$("#ContentPlaceHolder1_ViewerTabVisibleHidden").attr("value", "0");
}
if (tabToSelect)
tabToSelect.set_selected(true);
}
0
Johnny
Top achievements
Rank 2
answered on 21 Feb 2012, 03:28 AM
i achived by adding 2 extra lines in CloseTab event
function
CloseTab(tabText) {
var
tabStrip = $find(
"ctl00_ContentPlaceHolder1_PageTab"
);
var
multiPage = $find(
"ctl00_ContentPlaceHolder1_MultiPage"
);
var
tab = tabStrip.findTabByText(tabText);
var
pageView = tab.get_pageView();
var
tabToSelect = tabStrip.findTabByText(
"Mail"
);
tab.set_visible(
false
);
pageView.hide();
tab.unselect();
tab.disable();
if
(tabText ==
"Search"
) {
$(
"#ContentPlaceHolder1_ResultTabVisibleHidden"
).attr(
"value"
,
"0"
);
}
else
if
(tabText ==
"Viewer"
) {
$(
"#ContentPlaceHolder1_ViewerTabVisibleHidden"
).attr(
"value"
,
"0"
);
}
if
(tabToSelect)
tabToSelect.set_selected(
true
);
}