Hide text of search box in sharepoint - search

I want to hide the text of a searchtextbox, but I don't know how to do it. I'm a Sharepoint noob, so I think it is easy to do it but I don't know how... I put my code below, hope it helps:
<SharePoint:AjaxDelta ID="DeltaSiteLogo" runat="server" BlockElement="True">
<!--search-->
<SharePoint:AjaxDelta ID="DeltaPlaceHolderSearchArea" BlockElement="true" CssClass="ms-mpSearchBox ms-floatRight" runat="server">
<asp:ContentPlaceHolder ID="PlaceHolderSearchArea" runat="server">
<div id="searchInputBox">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />
<script type="text/javascript">
setTimeout(function () {
document.getElementById('SmallSearchInputBox').placeholder = 'Ex: SMS1234';
document.getElementById('SmallSearchInputBox').value = 'Ex: SMS1234';
}, 800);//time to wait for in ms
</script>
</div>
</asp:ContentPlaceHolder>
</SharePoint:AjaxDelta>
<SharePoint:SPLinkButton runat="server" CssClass="ms-siteicon-a" ID="x36d5bee949a7480783b3afc048c15598" NavigateUrl="~sitecollection/Pages/Inicio.aspx">
<SharePoint:SiteLogoImage name="onetidHeadbnnr0" runat="server" CssClass="ms-siteicon-img" ID="x74bbee6762f840edad4fe46f496d8c78" LogoImageUrl="/_layouts/15/images/siteIcon.png"></SharePoint:SiteLogoImage>
</SharePoint:SPLinkButton>
I follow this link, but this solution didn't work for me and It doesn't change the text of the textbox:
Can anyone help me? Thanks a lot!

The control ID will change as page inherit, for example:
Try to use jQuery regex selector, for example:
$('div[id*="SmallSearchInputBox"]')

Related

Client Side redirect to new page in Sharepoint (2010) usercontrol

I want to redirect to new page on a button click in sharepoint usercontrol i have tried the following but its not redirecting .In my UC i have the following code
<script type="text/javascript">
function Redirect() {
var text = $('#txtTitle').val();
window.location.href = "../Pages/Search.aspx?t=" + text;
}
</script>
<asp:TextBox ID="txtTitle" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" Text="Search" runat="server" OnClientClick="Redirect()" />
You are not redirected to your search page because the Asp Button does a postback.
Update the Button to:
<asp:Button ID="btnSearch" Text="Search" runat="server" OnClientClick="Redirect(); return false;" />
You also need to update your javascript code according to Focas answer.
Regards,
Martin
When you change html to webcontrol you need to use the clientID of your textbox, as it is changed by the server. Try to use this instead:
var text = $("<%= txtTitle.ClientID %>").val();
additionally you can even use jquery only:
var text = $('input[id$="txtTitle"]').val();

master-pages SharePoint2010- Show content

I have created a new master page to SharePoint 2010. Right now I'm just trying to make it work. I want to display who modified the page and when. This works great whit this code:
<SharePointWebControls:DateTimeField FieldName="Modified" runat="server" ControlMode="Display"/>
by
<SharePointWebControls:UserField FieldName="Modified By" runat="server" ControlMode="Display"/>
But my problem is that when i Load the SP-page with my master-Page this part of the page stays for 0.5 seconds and then disappears. My question is: Do you know how I can make the modified and modified by content to stay on my site?
Thanks for your help!
The Answer to my Question was that I had to put the cod from the question before this tag:
<asp:ContentPlaceHolder id="PlaceHolderFormDigest" runat="server">
so my finished cod looks like this:
<!-- Footer with Last modified/modified by and date of the day -->
<div class="s4-notdlg" style="clear:both; background-color:white; padding:10px; margin-left:160px;">
<div class="hide">
<div>
Idag är det
<script type="text/javascript">
var date = new Date();
document.write(date.toLocaleDateString());
</script>
</div>
Senast uppdaterat:
<SharePointWebControls:DateTimeField ID="DateTimeField1" FieldName="Modified" runat="server" ControlMode="Display"/> av
<SharePointWebControls:UserField ID="UserField1" FieldName="Modified By" runat="server" ControlMode="Display"/>
</div>
</div>
<SharePoint:DeveloperDashboard ID="DeveloperDashboard1" runat="server"/>
</div>

Ext.NET 2.0 how to get the value of datefield

I want to get from datefield. Ext.NET 2.0 is a little bit difficult to study.
This is a source of simple datefield.
<ext:DateField ID="DateField1" runat="server"
Vtype="daterange" FieldLabel="To" EnableKeyEvents="true" />
and I'd like to set the value on my Textbox.
myTextbox.setValue(App.MainContent_DateField1.getValue());
help!!
Just found the answer to this - using getRawValue() function
myTextbox.setValue(App.MainContent_DateField1.getRawValue());
I tested the basic scenario and it appears to work correctly.
You might need to call .format() to convert your DateField value into a nicely formatted string, but that is not required.
Here's a full sample demonstrating the scenario. Select a Date from the DateField, then click the Button. The DateField value will be copied to the TextField.
Example
<%# Page Language="C#" %>
<%# Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:DateField ID="DateField1" runat="server" />
<ext:TextField ID="TextField1" runat="server" />
<ext:Button
runat="server"
Text="Submit"
OnClientClick="TextField1.setValue(DateField1.getValue().format('d-M-Y'));"
/>
</form>
</body>
</html>

how to use the updatepanl and postback trigger and progress templete in asp.net ajax

hi i am using update panel in my project, one page i have file upload control is there, so save the page file upload is not working that time i used post back trigger control (id is button id) now my problem is progress bar is not working , please give me any suggestion. my code is
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdatePanel ID="up1" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="IBtnSave" />
<asp:PostBackTrigger ControlID="ddlAgent" />
<asp:PostBackTrigger ControlID="btnSelectCity" />
<asp:PostBackTrigger ControlID="imgBtnAgent" />
<asp:PostBackTrigger ControlID="ImgBtnCancel" />
</Triggers>
progress bar code is
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="up1"
DynamicLayout="true">
<ProgressTemplate>
<div id="Progressbar" class="Progressbar" align="center" valign="middle" runat="server">
<asp:Image ID="Image1" Width="75" Height="95" runat="server" ImageUrl="~/images/animation_processing.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
how to solve that problem, please give me any suggestion
Thank u
hemanth
i can find out the answer it is working
just write the java script like this
<script type="text/javascript">
var updateProgress = null;
function postbackButtonClick() {
updateProgress = $find("<%= UpdateProgress1.ClientID %>");
window.setTimeout("updateProgress.set_visible(true)", updateProgress.get_displayAfter());
return true;
}
</script>
after that
<asp:UpdatePanel runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="IBtnSave" />
</Triggers>
button onclick event just call that function like this
<asp:Button ID="IBtnSave" runat="server" Text="Save" CssClass="art-button"
ClientIDMode="Static" onclick="IBtnSave_Click" OnClientClick="return postbackButtonClick();"/>

Removing contents of PlaceHolderPageTitleInTitleArea

In sharepoint there is a content place holder called PlaceHolderPageTitlteInTitleArea. I'm trying to remove everything in it from a custom RenderingTemplate that I placed in CONTROLTEMPLATES. So is it possible to achieve this either by using inline code or some other ways.
Right now I've fixed it with this code in my SharePoint:RenderingTemplate control
<script type="text/javascript">
var tableArea = document.getElementById('onetidPageTitleAreaFrame');
if (tableArea != null) {
tableArea.style.height = '25px';
}
var titleArea = document.getElementById('onetidPageTitle');
if (titleArea != null) {
titleArea.style.display = 'none';
}
</script>
If you create a Custom Master Page and modify the
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
tag to read
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" Visible="false" />
instead, you can achieve the same result. You can create a Custom Master page by opening the site using SharePoint Designer, creating the new Master Page, copying the contents of Default.master into it, then modifying the placeholder tag, and setting that new Master page as the Custom Master page.
You can also create a Panel control, set its visibility to false, and drop in all the placeholders which you would not want to be rendered on screen:
<asp:Panel visible="false" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
</asp:Panel>
Hope this helps.

Resources