When hovered over the text 'Bedroom', the blue dotted box appears over it, but clicking on it, does not place the cursor, as if it is read-only.
However, I am able to edit the rendered images. And also the text 'Water View Loft' coming from another repeater, without issues.
ascx:
<asp:Repeater ID="rpPhotos" runat="server" ItemType="Sitecore.Data.Items.Item">
<ItemTemplate>
<div class="item">
<p>
<sc:Text runat="server" Field="Title" Item="<%#Container.DataItem %>"/>
</p>
<sc:Image runat="server" Field="Image" Item="<%#Container.DataItem %>" />
</div>
</ItemTemplate>
</asp:Repeater>
The fields Title & Image are from a template called Base Content. I have used this template to render other repeater in the same user control & there I can edit the text & images.
Why is this happening?
Try to remove the <p> tag, and see if the field gets editable. The Page Editor gets broken on nested <p> tags, and perhaps it happens also in your case.
Try to set the DisableWebEditing="false".
Related
I have the following ASP.NET Literal Control displayed on my page
<div class="col-md-8 text-justify">
<p>
<asp:Literal ID="Literal1"
Mode="PassThrough"
Text= "<%#:Item.Description %>"
runat="server">
</asp:Literal>
</p>
</div>
This control is bound to a field in my SQL Server Table and a column called Description in the table contains the text with HTML tags like <p> <ul> <br> etc.
However when the text is displayed in the Literal control, it is displayed as-is i.e the HTML does not get rendered.
If the Literal control does not support rendering, what other options do I have?
Your problem isn't with the Literal control. It's the way you embedded the HTML. Try this:
<asp:Literal ID="Literal1"
Mode="PassThrough"
Text= "<%# Item.Description %>"
runat="server">
</asp:Literal>
Notice I left out the colon? That colon is there to prevent injection attacks, where the contents of the value being embedded might come from a user. But if you trust the HTML content, then removing the colon will embed the HTML and allow it to render properly instead of escaping it.
My images are stored in a SQL database. I bind to the table and use the generated image control and a ashx handler. No problem. I now have the thumbnail image surrounded by a anchor tag. The problem come in finding the large image thats in a hidden div and display ONLY that.. I don't want a gallery just that one image. If you are reading this you know that datalists when generating their controls assigns mangled ID's to their components. How can I address that image from my thumbnail image?
<asp:DataList ID="datalist" runat="server" RepeatColumns="3" RepeatDirection="Horizontal">
<ItemTemplate>
<a class="colorme" href="#">Actual thumbnail image</a>
<div style="display:none">
<div id="colorme" runat="server">Actual image to display
</div>
</div>
</ItemTemplate>
</asp:DataList>
ASP.NET 4.0 no master page.
Assign ID and run at server for your Image and use
<%= yourimage.ClientID %> this will return that particular image wherever you'll use it..not the mangled IDs generated by Datalist control.
The simplest solution would be to use jQuery, and find the element using the next-sibling selector.
$(".colorme").click(function(){
$(this).find("~ div").show();
});
This would work no matter how many images you have on the page.
I have an ASP.Net GridView and I want to include an Image and a Text in the same field, something like this:
<a id="lnkForJQueryCall"><img src="whatever.png"> Some Other Number</a>
I have found the asp:ImageField does not have a Property for adding a text at right or left of the image, and there are no much options, is there any way to achieve it?
[EDIT] I was thinking of a css class workaround but have not figured out how to do it !!
You can use a TemplateField to display custom content in a data-bound control such as a GridView.
<asp:TemplateField>
<ItemTemplate>
<a id="lnkForJQueryCall"><img src="whatever.png"> Some Other Number</a>
</ItemTemplate>
</asp:TemplateField>
I'm using AJAX.Net (3.5) inside a usercontrol.
The usercontrol contains an UpdatePanel, and inside the UpdatePanelthere is a MultiView.
The ScriptManager is included in the page that act as container for the usercontrol.
To switch between views the usercontrol contains a simple button.
When I click it, the View is changed so the old content is hidden and new content is displayed.
My problem is that the content isn't hidden at all.
The view changes and the new content is displayed, but the old one remains on the page.
To isolate the problem, I tried changing the multiview and switching visibility of a simple label, but the behavior is the same.
Any ideas?
oh I understand. It's all right then. The problem is not of Ajax here. It's just you cannot embed something in <table> tags. In this case, you can try something different than the <table> control. Maybe a <div> or something else. I don't know exactly what sort of situation you have. Maybe you explain the result you want to achieve so I can give you some advice.
Regards
It seems that AJAX.Net doesn't work very well if you have part of a table outside the UpdatePanel.
On my control I want to show or hide some rows of a table. I included only the tr and td tags inside the updatepanel.
To reproduce the problem:
<table>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<tr>
<td>
<asp:Label ID="lblToShow" runat="server" Text="Label to show" Visible="false" />
<br />
<asp:Label ID="lblToHide" runat="server" Text="Label to hide" />
</td>
</tr>
</ContentTemplate>
</asp:UpdatePanel>
</table>
If you change the visibility using:
lblToShow.Visible = true;
lblToHide.Visible = false;
The text of both labels are shown on the page (lblToHide does not hide)
If you move the table tags inside the UpdatePanel everything works fine.
call
updatepanel.Update()
after you make the changes to your updatepanel
or try
updatepanel.Controls.Clear();
What is the difference between <asp:Panel > and <asp:PlaceHolder > in ASP.NET?
When should you use one over the other?
A panel expands to a span (or a div), with it's content within it. A placeholder is just that, a placeholder that's replaced by whatever you put in it.
The Placeholder does not render any tags for itself, so it is great for grouping content without the overhead of outer HTML tags.
The Panel does have outer HTML tags but does have some cool extra properties.
BackImageUrl: Gets/Sets the
background image's URL for the panel
HorizontalAlign: Gets/Sets the
horizontal alignment of the parent's
contents
Wrap: Gets/Sets whether the
panel's content wraps
There is a good article at startvbnet here.
PlaceHolder control
Use the PlaceHolder control as a container to store server controls that are dynamically added to the Web page. The PlaceHolder control does not produce any visible output and is used only as a container for other controls on the Web page. You can use the Control.Controls collection to add, insert, or remove a control in the PlaceHolder control.
Panel control
The Panel control is a container for other controls. It is especially useful when you want to generate controls programmatically, hide/show a group of controls, or localize a group of controls.
The Direction property is useful for localizing a Panel control's content to display text for languages that are written from right to left, such as Arabic or Hebrew.
The Panel control provides several properties that allow you to customize the behavior and display of its contents. Use the BackImageUrl property to display a custom image for the Panel control. Use the ScrollBars property to specify scroll bars for the control.
Small differences when rendering HTML: a PlaceHolder control will render nothing, but Panel control will render as a <div>.
More information at ASP.NET Forums
I weird bug* in visual studio 2010, if you put controls inside a Placeholder it does not render them in design view mode.
This is especially true for Hidenfields and Empty labels.
I would love to use placeholders instead of panels but I hate the fact I cant put other controls inside placeholders at design time in the GUI.
As mentioned in other answers, the Panel generates a <div> in HTML, while the PlaceHolder does not. But there are a lot more reasons why you could choose either one.
Why a PlaceHolder?
Since it generates no tag of it's own you can use it safely inside other element that cannot contain a <div>, for example:
<table>
<tr>
<td>Row 1</td>
</tr>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</table>
You can also use a PlaceHolder to control the Visibility of a group of Controls without wrapping it in a <div>
<asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible="false">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:PlaceHolder>
Why a Panel
It generates it's own <div> and can also be used to wrap a group of Contols. But a Panel has a lot more properties that can be useful to format it's content:
<asp:Panel ID="Panel1" runat="server" Font-Bold="true"
BackColor="Green" ForeColor="Red" Width="200"
Height="200" BorderColor="Black" BorderStyle="Dotted">
Red text on a green background with a black dotted border.
</asp:Panel>
But the most useful feature is the DefaultButton property. When the ID matches a Button in the Panel it will trigger a Form Post with Validation when enter is pressed inside a TextBox. Now a user can submit the Form without pressing the Button.
<asp:Panel ID="Panel1" runat="server" DefaultButton="Button1">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Input is required" ValidationGroup="myValGroup"
Display="Dynamic" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="myValGroup" />
</asp:Panel>
Try the above snippet by pressing enter inside TextBox1