Webpart title visible while editing, invisible after - css

I have a pretty strange Sharepoint 2010 problem. I have a webpart, which outputs the content of a list.
The webpart has a title with a styled background.
When I edit the webpart, it looks like it should. It has the nice background color, it shows the text ect. However, when I go to the page where the webpart should be, the webpart title is gone. It is not rendered in the HTML code (and therefore, I guess it's not a styling issue).
This is the rendered HTML while editing the page:
<td id="WebPartTitleWPQ6" class="ms-WPHeaderTd" title="Documents">
<h3 class="ms-standardheader ms-WPTitle" style="text-align:justify;">
<a href="link" accesskey="W">
<nobr>
<span>Documents</span>
<span id="WebPartCaptionWPQ6"></span>
</nobr>
</a>
</h3>
</td>
And when not editing, this td is never rendered.
The content in the webpart, is shown.
It shouldn't be a security problem, as I've moved the web part around so i've tried different zones. I've also tried different css classes.
Last of all, i've made sure the Chrome isn't none. I've tried all.
Any ideas why the webpart title is not shown?

Follow the stpes given below may be it can solve your problem :
Open Sharepoint Designer 2010.
Open the Masterpage in Advanced mode.
Located the <title> tag. It contained an <asp:ContentPlaceHolder> tag.
Remove any spaces between the <title> and </title> tags.
That means, the title tag started and ended in the same line.
Save and Publish.
Let me know the outcome.
Thanks

Related

Page design changed when html moved to aspx page

I am facing a strange issue. I have a html page whose design is perfect but when I am copying the same to aspx then design got distorted. Now, when I removed
<form id="form1" runat="server"> and <head runat="server">
attribute then design got corrected.
I am not sure why this has happened and how can I fix that because I don't think it's a good idea to remove form tag from aspx page
I fixed this issue.
Some of my CSS was referring to ID, when I changed it to class it started working as per my expectation.
It is an important note for all ASP.NET webform developers: "Do styling with class only"
Ex: #Myclass
{
height:10px;
}
<div id="divId" class="MyClass"></div>
Check your .css file(s) of your application where aspx resides. There must be styles defined for form element.
Better way to check style relaed issues is to use browser's developer tools.

ASP.Net Page Template and using asp tag in rendered pages

I want to use page templating in ASP.Net (Visual Studio 2012 with .Net 4.0).
The base page emits the basic template inclusive of the body, html, form, and other tags. That means the rendered pages just have what goes inside the body part. The template adds the header and footer. Although I have not finalized a design, I am looking at a concept documented here. (Yes, I know that coding practice is to not give links to pages, which can go away, but I do not want to side track the question.)
The part of each page is:
<%# Page language="c#" Codebehind="AdvancedPageInheritance.aspx.cs" AutoEventWireup="true" Inherits="PageInheritanceSample.AdvancedPageInheritance" %>
Anything after that first line is part of the body.
If I drag and drop controls onto the form, VS2012 emits code such as:
<asp:CheckBox ID="CheckBox2" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" />
<asp:Button ID="Button2" runat="server" Text="Button" />
VS2012 automagically emits the warning, "Unrecognized tag prefix or device filter 'asp'."
One thought is to simply add in the body stuff programatically, but that is a page. I rather use the GUI.
How can I avoid the warning? Is there a better way to do templates? That author wrote the article 10-years ago, so things might have changed since then. The warnings are understandable, but in error, as there is a form, body, and html tags, just not directly visible.
(I just answered my question by catching a phrase in Vs2012 and researching it a bit. Master Pages are the answer. Obviously, Microsoft must have added that with either VS2008 or VS2010. I will leave this post, as others, like me, may not know the concept "Master Page" and may reserach page templates, just like I did. I hope that this post says other people time. Google should hopefully pick up on ASP.Net and Page Templates.)
Ideally you would use the MasterPage for laying out your main template.
Your Content pages would then have the appropriate <asp:Content /> controls, where you add your content. To add a content page you would add a new 'Web Form' item in Visual Studio and, by selecting the 'Select Master Page' checkbox, you can choose the master page the content page should use.
See Here for a tutorial on Master Pages
Then you would use a BasePage for site-wide code; for example anything that has logic needed on most pages. Your Content pages would inherit this BasePage
As a side-note, see this page Unrecognized tag prefix or device filter 'asp' in VS2012 with regards to your "Unrecognized tag prefix or device filter 'asp'." message

How do I get <%= Html.Encode(item.name) %> in the title and head of page elements

How do I get <%= Html.Encode(item.name) %> in the title and head of page elements
I am wanting to use this the content place holder - title content, and main content. However each time I try to add these in the those elements i get an error basically saying this not allowed.
<h2>Performances for :<%= Html.Encode(item.venue) %></h2>
this is what I have been doing but it wont work
can somebody please help with my query, thanks.
Remove the runat="server" attribute from your <head> tag. It's legacy left from the good ol' days of WebForms which has no any viable meaning in MVC that someone forgot to remove from the default template.
Also if the item variable is not available in the masterpage you could use a content placeholder which will be redefined in each view if this variable is part of a view model which is only available in views.
Maybe try it without putting <h2> tags into the <title> section of the page.

asp:Content and client side scripting

I'm fixing a customer site designed in ASP.NET, using Master pages. I need to put a jQuery adgallery inserted in a Content page which is linked to the master page.
<asp:Content ContentPlaceHolderID="cphHeader" runat="server">
<div class="ad-gallery">
</div>
</asp:Content>
Since that Content renders in server-side, the jQuery ad gallery does not work.
What workaround, if available, I can use to insert a jQuery gallery in this Master page placeholder?
It looks like you might be trying to put the in the Content placeholder intended for the html head element of your master page (this is from the id of the content placeholder). In a ASP.Net content page typically you have two content placeholders one that is for the head element and one for the body element. So in the head content placeholder you would put your scripts and other resources in the body content placeholder you would put your html markup such as the div.
For the second part of your question if you use $(document).ready() and wireup your gallery from there you are assured that the DOM elements you are trying to work with will be loaded on the page.

How can I automatically highlight a specific character in link text using JQuery + CSS?

I'm adding hotkeys to a web application in order to enable keyboard shortcuts for our CSRs to use, to reduce injury and increase calls-per-hour. I'm using an ASP.net UserControl to inject javascript into the page and it's working great.
I want the control to "just work", so that when hotkeys are assigned, using a declarative syntax, if the hotkeyed letter exists in the link text, it will be highlighted automatically, so the developer doesn't have to do anything, and also to maintain consistency in visual cues.
Here's the code to assign hotkeys, if it matters:
<uc:HotKeysControl ID="theHotkeys" runat="server" Visible="true">
<uc:HotKey ControlName="AccStatus$btnInvoiceEverBill" KeyCode="ctrl+v" />
<uc:HotKey ControlName="AccStatus$btnRefund" KeyCode="ctrl+u" />
<uc:HotKey ControlName="thirdControl" KeyCode="ctrl+p" />
</uc:HotKeysControl>
I want something like:
Make a <span class=hotkey">P</span>ayment
...but I'm not married to the idea of injecting a <span/> in there if there's a better way.
How can I do this in CSS or JQuery? Is there a way to pass in a letter to a CSS style and have it change the color of the text displayed? Should I generate javascript to highlight the text when the page loads?
What would/did you do in this situation?
What about something along the lines of:
$("a:contains('Payment')").html(function(i, old_html) {
old_html.replace(/Payment/, '<span class="hotkey">P</span>ayment');
})

Resources