How to show content from contentPlaceholder inline - asp.net

I have a page where in my masterpage have a toolbar with a "Home" button to the far left. This button is not in a contentplaceholder but on the page.
I want to have the opportunity for derived pages to add their own controls or whatever to the toolbar to be whown after the "home" button. But how to do this?
I have tried to put in a contentplaceholder, but it seems that I cannot get it to show inline with the other stuff, it breaks and the content of the contentplaceholder is shown below the button instead.
Does anyone know how to solve this?
Update:
Regarding the comment from #Remy below:
Do you, by chance, have a line break
in the masterpage's markup between the
button and contentplaceholder?
I started looking and because I'm a bit inexperienced at designing with CSS (when aligning text and an image vertically center). I created a table that enclosed each button - forgot that table are block elements, so there was my line break.

You can make the toolbar in the MasterPage available through a public property. Then you can access the master page from the content using Content.Master propery. Then you can add the controls to the toolbar as you add any runtime control.
Also, you need to Typecase the Content.Master to the type of your master file class before accessing its public property.

There are many ways:
from derived page you can get to the master page content over Page.MasterPage, and manipulate by controls located there. So you just need to allocate at master server-div or Panel and locate it by Page.MasterPage.FindControl to populate with particular inline elements
ContentPlaceholder does nothing with HTML layout, so you header can looks like:
<div>
<span> <!-- your Home button declaration goes there --> </span>
<span> <asp:ContentPlaceHolder ... </span>
</div>

Related

How to make invisible ASP.NET controls within a certain div tag?

I have a dropdown "ddl_group" list followed by two tags containing controls related to item chosen in the first. One item in ddl_group is teacher and another item is student. By default, I have set all controls within the two div tags to invisible. They only show up when a group related to them is chosen in ddl_group.
Imagine I choose student in ddl_group. Next, controls within div.stdInfo start to appear one after the other in response to user who makes choices on controls within div.stdInfo. Now the user might want to choose another group i.e. teacher from ddl_group. Therefore, I'll need to make invisible again all controls within div.stdInfo and make visible controls within div.teacherInfo.
Is it possible to make invisible or visible all asp.net controls within a certain tag (e.g. div tag) in one place rather than setting them individually?
You can place your div in
ASP.NET Panel Control
then you can make it
pnlName.Visible=true; or pnlName.Visible=false;
when ever you want or
you can use Div with
runat="server"
attribute so that it is accessible in code page
their you can do it like
divname.Visible=true; divname.Visible=false;
You can use ASP.NET Place holder or ASP.NET Panel controls for these purposes.
Wrap your content with Place holder or Panel.
On SelectedIndexChanged event of your drop down, you can change visibility of this PlaceHolder or Panel.
If you add a runat tag and an ID tag to your divs, that will make them accessible via server side code. I prefer this way because I don't have to mess-up my css at all.
e.g.
markup:
<div class='teacherinfo' ID='teacherDiv' runat='server'>
.
.
.
.
.
</div>
code behind:
teacherDiv.Visible = false;
One word of warning, making a server-side control invisible means that it will not be present on the resulting html document. So if you try to find it with javascript document.getElementById("<%= teacherDiv.ClientId %>"), you'll get an error.

How to hide top toolstrip bar in ajax html editor extender

I have a asp.net textbox with ajax html ajax htmleditor extender in by deafault all toolbars will come if we write tollbars tag inside htmleditor extender by using this we can show the toolbars what ever we want but i want to hide entire toolbars. please help me
Please go through the following link showing how to hide some of the buttons with wrapper of it. You can use it for hiding all or displaying some of them.
http://www.asp.net/web-forms/tutorials/ajax-control-toolkit/htmleditor/how-do-i-use-the-html-editor-control-cs
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/htmleditorextender/htmleditorextender.aspx
Dont use the title property for
<ajaxToolkit: /> within toolbar <Toolbar>
Thankyou
Use the css or jquery
.ajax__html_editor_extender_buttoncontainer { display : none !important }
- See more at: http://www.dotnetlines.com/forum/tabid/86/forumid/6/threadid/142/scope/posts/Default.aspx

Master and Content Pages VB.Net

I created a master page using visual studio. I'm trying to add content my pages but I'm having an issue. It's probably a simple thing that I'm missing.
My master page has a few divs. Basically a Header, a Sub Header, a left column with a menu, a Footer and then the bulk of the page is my Main.
My example video shows the instructor just dragging an image over to the body of the content page (in design view) and it works. She also dragged a gridview and a couple other items.
This part is annoying me because it's hanging me up.
Any thoughts?
I figured it out. I created several divs. When I did this my content placeholder shifted all the way down to the bottom, which is why my content was placed on the bottom.
I fixed my code so that way I had something like this.
<div id="Main">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
which fixed it. You need those lines and the in order to place the content in the main.
I am happy I found my problem.
JWV

Wordpress editor: lock editing part of page

My client wants to edit pages content in Wordpress. I had to disable visual editor because it ruins custom html. The problem is my client isn't familiar with HTML.
What I want is to lock part of source code in WP editor for ex. in line
<div class="whatever">Lorem ipsum</div>
I want to allow him to modify only "Lorem ipsum" part.
How can I do that?
well you can provide a textarea for him to enter text and then replace html inside element with class whatever, so basically you control regions of html where modifications can be made instead of whole page, of-course you need to write some code to do so.
I would simply mark the editable regions with some kinda class, and then on page load add some script which will pick all regions with that clas and show a small editable button there, on click of those button a shim with text area would pop up where user can add his text/html and on done, the markup would be injected inside the element. Later on save, the whole page would can be saved, little tricky but can work :)

ASP.NET TreeView nodes not expanding and collapsing

I have a TreeView menu populated from a SiteMapDataSource. The TreeView defaults to all nodes expanded, but the normal client side expand/collapse behaviour for the nodes is not working. I get one Javascript error in my Firebug console, being:
TreeView_ToggleNode is not defined
What could be causing this?
The TreeView menu is on a page that displayed content pages in an IFrame. The TreeView is bound to a SiteMapDataSource, and for convenience, the developer added a <base> tag to the page, declaring the target of all links on the page to be the IFrame. The TreeView uses javascript links for it's navigation buttons and setting a base target breaks these all.
I solved the problem by selectively setting only the actualy menu links, not the expand and collapse buttons, to have a target of the IFrame, with the following jQuery:
$("#navigation a[class^=menu]").attr("target", "iframe1");

Resources