How to insert a asp:TabPanel inside a asp:Repeater? - repeater

When I try to execute the below code it gives me the error "There was an error rendering the control. Check to make sure all properties are valid".
Inner repeater works fine inside the tab container. But outer does not allow to have a tab panel within it.
Tab containers are not available in asp.net toolbox and therefore I installed Ajax tool kit and added that to Visual Studio and refer that Assembly as follows.
<%# Register Assembly="AjaxControlToolkit, Version=1.0.11119.25966, Culture=neutral,PublicKeyToken=28f01b0e84b6d53e" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Repeater ID="ProjectRepeater" runat="server">
<ItemTemplate>
<cc1:TabContainer ID="TestTabContainer" runat="server">
<cc1:TabPanel ID="TestTabPanel" HeaderText="technologies" runat="server">
<ContentTemplate>
<asp:Repeater id="SkillsRepeater" runat="server">
<ItemTemplate>
<div class="project-technologies" id="SkillZone" runat="server">
<a id="skill" href='<%# "http://vingo/Pages/projectresults.aspx?k="+DataBinder.Eval(Container.DataItem, "Skill")%>' target="_blank"><%# DataBinder.Eval(Container.DataItem, "Skill")%></a>
</div>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
EDIT: Outer repeater code
<asp:Repeater ID="P" runat="server">
<ItemTemplate>
<cc1:TabContainer ID="TTC" runat="server">
<cc1:TabPanel ID="TTP" HeaderText="t" runat="server">
<ContentTemplate>
<asp:Repeater id="A" runat="server">
<ItemTemplate>
<%--Code--%>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</ItemTemplate>
</asp:Repeater>

Instead of a asp.nett Repeater I could use the below code and it did the expected work of a asp.net Repeater and flexibility is much higher than when using asp:Repeaters
function JsonPCallBack(result) {
for (var technology in result) {
$('body').append('<div OuterDiv id=OuterDivId><div class=project-technologies id=SkillZone><a id=skill href=http://vingo/Pages/projectresults.aspx?k=' + technology + 'target=_blank></a></div>');
}
}

Related

How to have the border in a div appear only if Webpart zone has a webpart in it>

I have a webpart wrapped in a div that has a border applied to it (class="wpz-1"). The border appears on the page regardless if the webpart zone has a webpart in it or not. How can I make the border appear only if the webpart zone has a webpart in it?
<div class="wpz-1">
<div data-name="WebPartZone">
<!--CS: Web Part-->
<!--SPM:<%#Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<div xmlns:ie="ie">
<!--MS:<WebPartPages:WebPartZone runat="server" AllowPersonalization="false" ID="x8600600cbb2046468f9615155e5fd921" FrameType="TitleBarOnly" Orientation="Vertical" >-->
<!--MS:<ZoneTemplate>-->
<!--DC: - Web Part -->
<!--ME:</ZoneTemplate>-->
<!--ME:</WebPartPages:WebPartZone>-->
</div>
<!--CE: Web Part-->
</div>
</div>
You could try to change the div attribute based on child elements of your zone(if no webpart in webpart zone, it will not display based on my testing, so check the webpart zone to confirm whether there is webpart inside <div customAttr="customAttr").
Just demo:
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
<style>
.wpz-1{
border:1px fuchsia groove;
}
</style>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript">
$(function () {
if ($('div.ms-webpart-zone', 'div[customAttr="customAttr"]').length < 1) {
$('div.wpz-1').removeClass("wpz-1");
}
})
</script>
<WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager"></WebPartPages:SPProxyWebPartManager>
<p></p>
<div class="wpz-1">
<div data-name="WebPartZone">
<div customAttr="customAttr" xmlns:ie="ie">
<WebPartPages:WebPartZone runat="server" AllowPersonalization="false" ID="x8600600cbb2046468f9615155e5fd921" FrameType="TitleBarOnly" Orientation="Vertical" >
<ZoneTemplate>
<!--DC: - Web Part -->
</ZoneTemplate>
</WebPartPages:WebPartZone>
</div>
</div>
</div>
</asp:Content>

How to write jest test cases for navigation in react

I am new to Jest test cases writing, Trying to write the test case for checking navigation in an react application.
Currently I have written test case which works like below:
I have Login page which is having register link on it, which redirects user to the Register page. So what I am checking is
1. Loading the login page
2. Triggered Register link click event
3. So user moved to the Register page
but I am not able to check if the Register page is loaded or not? Is there any way to check the snapshot of the "Register" page and link in URL.
I have used jest, enzyme and react-test-render as shown in below code.
Login Page Html
<React.Fragment>
<BodyContainer noDrawer fullSpan>
<Grid container spacing={0} className={classes.gridContainer}>
<Grid item xs={12} md={6} lg={7} className="login--form">
<div className="login--form--container">
<img src={LogoPurple} alt="ABL" className="onboarding-logo" />
<h3>Welcome back! Please login to your account.</h3>
{error ? <p>{error}</p> : null}
<Field name="email" component={renderTextField} label="Email" style={styles.formField}/>
<Field name="password" component={renderTextField} label="Password" style={styles.formField} />
<Field name="rememberMe" component={renderCheckbox} label="Remember Me" />
<div className="has-spacing">
<Button variant="raised" size="large" color="primary" className="extraLarge" type="submit" onClick={this.handleSubmit}>
Login
</Button>
</div>
<Link to="forgot-password">Forgot Password</Link>
<p className="need-account">
Need an account?
<Link to="/register">
<strong> Sign up</strong>
</p>
</Link>
<LegalLinks />
</div>
</Grid>
</Grid>
</BodyContainer>
</React.Fragment>
In above code register is the link used to navigate.
thanks in advance...

Sitecore navigation user control?

Could you please provide some working examples for navigation in sitecore using user control instead of xslt rendering since I do not find a good one on sitecore sdn ?
thanks
One example:
http://www.launchsitecore.net/en/about-launch-sitecore/building-the-site/creating-the-site-menu
Markup
<ul class="nav">
<asp:Repeater ID="rptDropDownMenu" runat="server" OnItemDataBound="rptDropDownMenu_ItemDataBound">
<ItemTemplate>
<li id="MenuLi" runat="server">
<asp:HyperLink ID="MenuLink" runat="server">
<asp:Literal ID="MenuText" runat="server" />
</asp:HyperLink>
<asp:PlaceHolder ID="phSubMenu" runat="server" />
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
Code Behind
HomeItem = SiteConfiguration.GetHomeItem();
List<item> nodes = new List<item>();
if (HomeItem["Show Item In Menu"] == "1") nodes.Add(HomeItem);
foreach (Item i in HomeItem.Children)
{
if (SiteConfiguration.DoesItemExistInCurrentLanguage(i) && i["Show Item In Menu"] == "1")
{
nodes.Add(i);
}
}
rptDropDownMenu.DataSource = nodes;
rptDropDownMenu.DataBind();

jsf header navigation menu - template

I have template like here:
http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example/
i add menu navigation:
<h:form id="form">
<div id="page">
<div id="header">
<ui:insert name="header" >
<ui:include src="/pages/template/header.xhtml" />
</ui:insert>
<f:ajax render="ContentLoader">
<h:commandLink actionListener="#{contentPage.setPage('/pages/first.xhtml')}" value="About Us" />
<h:commandLink actionListener="#{contentPage.setPage('/pages/login.xhtml')}" value="Contact Us" />
</f:ajax>
</div>
<h:panelGroup id="ContentLoader" >
<div id="content">
<ui:insert name="content" >
<ui:include src="#{contentPage.page}" />
</ui:insert>
</div>
</h:panelGroup>
</div>
</h:form>
links are working fine, but i have problem with redirect content by useing <h:commandButton action="link"> which is in content
how can i fix this problem?
maybe it's something wrong with my layout?
or how to correctly redirect from content to another content, useing buttons which are in contents?
As to your concrete problem, it's likely caused by the combination <ui:include src="#{...}"> and a view scoped bean. This construct works only if you upgrade to at least Mojarra 2.1.18. Otherwise, the view scoped bean will fail to restore and be newly recreated and therefore the default value of #{contentPage.page} will be considered when any form actions inside the page are to be decoded. Upgrading to at least Mojarra 2.1.18 should fix your problem. You can get it at http://javaserverfaces.java.net. It's currently already at 2.1.25.
As to your concrete functional requirement, using command links/buttons for plain page-to-page navigation is a poor practice. You should be using output links/buttons for this.
<h:button value="navigate" outcome="link" />
or
<h:link value="navigate" outcome="link" />

sitecore: editframe

I need to use editframe to let the front user to modify some checkbox fields
I create a new edit frame button and set only those fields that I want front user to edit. For example : Core DB -> /sitecore/content/Applications/WebEdit/Edit Frame Buttons/(edit button folder)/(field editor button). In the fields to be edited by front user, I have set it to Headline.
In my sublayout, I have this code
<sc:EditFrame ID="EditField" runat="server" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/EditFields">
<div id="whatyoumissed">
<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
<ul style="list-style-type: none;" >
<asp:PlaceHolder runat="server" ID="itemplaceholder"></asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<li style="float: left;margin-left:20px;">
<sc:FieldRenderer ID="FieldRenderer2" runat="server" FieldName="Headline"
Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" /> <br />
<sc:FieldRenderer ID="FR3" runat="server" FieldName="cb" Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" />
</li>
</ItemTemplate>
</asp:ListView>
</div>
</sc:EditFrame>
Code behind
string queryPath = "/bla/bla/bla/bla/bla/bla/bla/bla/bla";
var item = sc.Context.Database.GetItem(queryPath);
var children = item.Children;
ListView1.DataSource = children;
ListView1.DataBind();
When I click on the edit frame in the page editor, the prompted box does not have the field (headline) for me to modify it. Any suggestion?
Answer:
I have google abit of sitecore edit frame datasource and end up with this link
http://blog.jan.hebnes.dk/2011/12/using-sitecore-editframe-with.html
Instead of using the code behind as shown by Martijn Bos, I modify my code from prev to the following.
<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
<ul style="list-style-type: none;" >
<asp:PlaceHolder runat="server" ID="itemplaceholder"></asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<sc:EditFrame ID="EditField" runat="server" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/EditFields"
DataSource="<%# ((Sitecore.Data.Items.Item)Container.DataItem).Paths.FullPath %>" >
<li style="float: left;margin-left:20px;">
<sc:FieldRenderer ID="FieldRenderer2" runat="server" FieldName="Headline"
Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" /> <br />
<sc:FieldRenderer ID="FR3" runat="server" FieldName="cb" Item="<%# Container.DataItem as Sitecore.Data.Items.Item %>" />
</li>
</sc:EditFrame>
</ItemTemplate>
</asp:ListView>
Have you tried setting the DatasSource of the Editframe?
e.g. EditField.DataSource = item.Paths.FullPath;
You almost there. Should not use "FullPath". Try this instead
DataSource="<%# ((Sitecore.Data.Items.Item)Container.DataItem).Paths.FullPath %>"