When i inserting the data in database then there is facility to the user that in multiline textbox he can write sentence in multiple line.
So when i am populating the same data the database it populate the data like this : fffffffffffffffffffffffffffffff<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> <br /> ff<br /> f<br /> f<br /> <br /> <br /> <br /> fff
but i want to remove <, > ,br. For this i have used following code but my purpose is not solved. So how to do that:
txtEditorOpportunity.Text = dbReader["DESCRIPTION"].ToString().Replace("<br/>", "\n");
There is a space in the <br /> tag in your question, so while using Replace method. Try it like
.Replace("<br />", "\n");
Note the space character between br and / which makes it <br /> and NOT <br/>
You are doing it correctly. Just observe the tags that you are getting, they contain a space between "". So make sure that you put a space in your replace command accordingly.
Something like this.
.Replace("<br />", "\n");
Some browsers treat <br /> as just <br>, so to be sure that nothing goes wrong, you can replace the above code with the following code.
.Replace("<br />", "\n").Replace("<br>", "\n");
Related
I'm trying to add a custom search form into my template, the TypoScript I used in a v7 install no longer works.
If I copy the Fluid form used in the extension (Form.html) and place it into one of my Fluid template a search box appears but it posts back to itself, even though I have set a rootPidList in my constants. This is the code I copy:
<f:form action="search" method="post" id="tx_indexedsearch" pageUid="{settings.targetPid}">
<div class="tx-indexedsearch-hidden-fields">
<f:form.hidden name="search[_sections]" value="0" />
<f:form.hidden name="search[_freeIndexUid]" id="tx_indexedsearch_freeIndexUid" value="_" />
<f:form.hidden name="search[pointer]" id="tx_indexedsearch_pointer" value="0" />
<f:form.hidden name="search[ext]" value="{searchParams.ext}" />
<f:form.hidden name="search[searchType]" value="{searchParams.searchType}" />
<f:form.hidden name="search[defaultOperand]" value="{searchParams.defaultOperand}" />
<f:form.hidden name="search[mediaType]" value="{searchParams.mediaType}" />
<f:form.hidden name="search[sortOrder]" value="{searchParams.sortOrder}" />
<f:form.hidden name="search[group]" value="{searchParams.group}" />
<f:form.hidden name="search[languageUid]" value="{searchParams.languageUid}" />
<f:form.hidden name="search[desc]" value="{searchParams.desc}" />
<f:form.hidden name="search[numberOfResults]" value="{searchParams.numberOfResults}" />
<f:form.hidden name="search[extendedSearch]" value="{searchParams.extendedSearch}" />
</div>
<fieldset>
<legend><f:translate key="form.legend" /></legend>
<div class="tx-indexedsearch-form">
<label for="tx-indexedsearch-searchbox-sword"><f:translate key="form.searchFor" />:</label>
<f:form.textfield name="search[sword]" value="{sword}" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword" />
</div>
<div class="tx-indexedsearch-search-submit">
<f:form.submit name="search[submitButton]" value="{f:translate(key: 'form.submit')}" id="tx-indexedsearch-searchbox-button-submit" class="tx-indexedsearch-searchbox-button" />
</div>
</fieldset>
And my typoscript:
config.index_enable = 1
page.config.index_enable = 1
plugin.tx_indexedsearch.settings.targetPid = 31
If I add the stock indexed search plugin to a random page, this will work.
Just to rule it out, I've also disable realurl just in case.
Thanks again T3 community.
if you just copy the search template into your output/ page template, there is no plugin available which provides values for the specific variables needed in this template-part.
either you use an output of a page where you have inserted the plugin (copy from HTML-source)
or you insert the plugin in all pages:
this can be done with a column you inherit and where the plugin is inserted on top level
or you use typoscript to render the plugin into a fluid-variable and display the generated HTML in your (page-)template.
I have a html control like
<input id="Button1" type="button" value="button" />
<input id="Text1" type="text" />
<img alt="" src="" id="img1" />
i want to set its tooltip or tittle in codebehind .
I tried the following code but its not working
Button1.Attributes["tittle"] = "i am button";
Text1.Attributes["tittle"] = "i am text";
img1.Attributes["tittle"] = "i am image";
this is not working please help
Set runat="server" for each control:
<input id="Button1" runat="server" type="button" value="button" />
Then in CodeBehind in Page_Load use this:
Button1.Attributes.Add("title", "i am button");
You need to mark those elements as runat="server" so that the server knows about them. Otherwise, server-side code won't be aware that they exist.
Alternatively, you could add a blob of javascript to the response message body and have the JS set the attributes. That's silly and ugly, though.
I have a web.config key :
<add key="IMGSRC" value="http://localhost" />
I want to use the value of this key along with the path of the image concatenated to in an aspx page. I'm aware that I can get to root folder by simply saying "../ImagesFolder" , but my website has parent path disabled because of security concerns. So now I need to work around it.
I need something like this (Here are a few things I tried after looking up the internet and which did not work.):
1) <img id="Img19" runat="server" alt="Admin" src='<%#ConfigurationSettings.AppSettings["IMGSCR"] %>' />
2) <img id="Img19" runat="server" alt="Admin" src='<%#ConfigurationSettings.AppSettings["IMGSCR"] + "/ImagesFolder/img.jpeg" %> ' />
3)
<img id="Img19" runat="server" alt="Admin" src="<%#ConfigurationSettings.AppSettings["IMGSCR"] %> " + "/ImagesFolder/img.jpeg" />
Also I tried this:
I declared a variable Path on Page_Load
Path = System.Configuration.ConfigurationManager.AppSettings["RootforIMG"].ToString();
and then on aspx page I tried using it as
<img id="Img19" runat="server" alt="Admin" src="<%=Path %> " + "/ImagesFolder/img.jpeg" /> but this as well is no good.
Can you try something like below?
<img id="Img19" runat="server" alt="Admin" src='<%= GetImageSource()%>' />
In code behind
public string GetImageSource()
{
return ConfigurationManager.AppSettings["IMGSCR"] + "/ImagesFolder/img.jpeg";
}
The relative path of images should work:
Relative path can be as per your page location i.e: '../IMages/img.jpg' or 'images/img.jpg'
try this :
<img id="Img19" runat="server" alt="Admin" src='ImagesFolder/img.jpeg' />
For controls with runat="server" attribute you do not need any special code to map a path relative to web site root:
<img id="Img19" runat="server" alt="Admin" src"~/ImagesFolder/img.jpeg" />
The path ~/ImagesFolder/img.jpeg will be resolved replacing ~ with the root folder of your web-site.
If to resolve path you need some kind of logic (for example you need to call a function) then you can use this:
<img src'<%= ResolveImageName() %>' />
Do not forget that URL must be proper encoded.
This button causes a lot of problems for my client, as it always uses a predefined Schema. I can't find a way to remove this button with my Editor config. I have done this with other buttons, but these buttons are implemented in some sort of sub-group.
On my personal sandbox machine, I tried removing the commented out control in the extract of the ../WebUI/Editors/CME/Controls/Toolbars/Tabs/CreateRibbonPage.ascx file shown below:
<c:RibbonSplitButton runat="server" CommandName="NewComponent"
Title="<%$ Resources: Tridion.Web.UI.Strings, NewComponent %>"
Label="<%$ Resources: Tridion.Web.UI.Strings, NewComponent %>"
ID="NewComponentBtn1">
<c:RibbonContextMenuItem runat="server" ID="NewComponentCMI2"
Command="NewComponent"
Title="<%$ Resources: Tridion.Web.UI.Strings, NewComponent %>"
Label="<%$ Resources: Tridion.Web.UI.Strings, NewComponent %>" />
<c:RibbonContextMenuItem runat="server" ID="NewMultimediaComponentCMI2"
Command="NewMultimediaComponent"
Title="<%$ Resources: Tridion.Web.UI.Strings, NewMultimediaComponent %>"
Label="<%$ Resources: Tridion.Web.UI.Strings, NewMultimediaComponent %>" />
<!--
<c:RibbonUploadContextMenuItem runat="server"
ID="NewBasicMultimediaComponentCMI2" Command="NewBasicMultimediaComponent"
Title="<%$ Resources: Tridion.Web.UI.Strings, NewBasicMultimediaComponent %>"
Label="<%$ Resources: Tridion.Web.UI.Strings, NewBasicMultimediaComponent %>" />
-->
</c:RibbonSplitButton>
This seems to have the desired result, but I imagine that this will probably invalidate our support agreement if I did this in a customer environment. Is this possible to do in a supported way, or do I have to hack the UI files like this to achieve my goal?
One of the solutions is to create extension for the NewBasicMultimediaComponent command, which extends isAvailable and isEnabled methods and returns false for them. In this case "Upload MM Component" still will be present as an option for "New Component" button, but it will be disabled.
I've used css to hide the display of ribbon items before. Purely because I couldn't find the appropriate solution.
I'm adding this answer because I needed to do something similar with a complete ribbon toolbar.
I needed to remove the complete ribbon toolbar "Create" in order to add a simpler version of it and it seems you can do the removal part by creating a new extension and use this in your extensions config:
<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge" xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration" xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions" xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu" xmlns:edt="http://www.sdltridion.com/2009/GUI/Configuration/Merge">
<resources>
<cfg:groups />
</resources>
<definitionfiles />
<extensions>
<ext:editorextensions>
<ext:editorextension target="CME">
<ext:editurls />
<ext:listdefinitions />
<ext:itemicons />
<ext:taskbars />
<ext:commands />
<ext:commandextensions />
<ext:contextmenus />
<ext:lists />
<ext:tabpages>
</ext:tabpages>
<ext:toolbars>
</ext:toolbars>
<ext:ribbontoolbars>
<ext:remove>
<ext:extension id="CreatePage">
<ext:apply>
<ext:view name="DashboardView">
<ext:control id="DashboardToolbar" />
</ext:view>
</ext:apply>
</ext:extension>
</ext:remove>
</ext:ribbontoolbars>
<ext:extendedareas />
</ext:editorextension>
</ext:editorextensions>
<ext:dataextenders />
</extensions>
<commands />
<contextmenus />
<localization />
<settings>
<dependencies />
<defaultpage />
<editurls />
<listdefinitions />
<theme>
<path>/Themes/</path>
</theme>
<customconfiguration />
</settings>
</Configuration>
To make this work for buttons you probably can do the same thing (haven't tested this), by providing the button id in the ext:extension id attribute.
In my XML, it's possible for an apostrophe to appear in a node's value:
<Root>
<Sections>
<SectionA>
<Heading>Title</Heading>
<Description>This is section 'A'</Description>
</SectionA>
</Sections>
</Root>
If I have controls bound to this XML:
<asp:FormView ID="myFormView" runat="server" DataSourceID="myXmlDataSource">
<ItemTemplate>
<div>
HTML Element:
<input type="text" value='<%# XPath("text()") %>' />
</div>
<div>
Server Control:
<asp:TextBox id="myTextBox" runat="server" value='<%# XPath("text()") %>' />
</div>
</ItemTemplate>
</asp:FormView>
<asp:XmlDataSource ID="myXmlDataSource" runat="server" XPath="Root/Sections/SectionA" />
I've noticed that the text is correctly displayed in the asp:TextBox but not in the INPUT element. I'm assuming that it's because server controls correctly escape the apostrophe. To work around this, I tried changing the Description node in the XML to the following:
<Description>This is section 'A'</Description>
Again, this displayed correctly in the asp:TextBox, but not in the INPUT element.
My next attempt was to wrap the node's value in a CDATA:
<Description><![CDATA[This is section 'A']]></Description>
Finally it was displaying correctly in the INPUT element, but now the asp:TextBox displayed the two "& # 3 9 ;". I've even tried "& a p o s ;" but the result is the same.
What is the best approach for the use of apostrophes in XML where the value can be displayed in either a server control or HTML element?
Here you have single quotes surrounding the value argument for the html element:
<input type="text" value='<%# XPath("text()") %>' />
This renders:
value='This is section 'A''
Instead use double quotes:
<input type="text" value="<%# XPath("text()") %>" />
Which renders:
<input type="text" value="This is section 'A'" />
Use ' instead. It is one of the 5 permitted entities in XML.
So your code would look like:
<Description>This is section 'A'</Description>