I m adding rss feed in out publish website which is related to advocate .
Create an XML file according to the RSS standard.
If you are using database driven website, you can manipulate a dynamic RSS feed from your DB. Assuming you are using PHP you can find the instruction on this link to create dynmic RSS feeds. http://www.broculos.net/tutorials/how_to_make_a_dynamic_rss_feed_in_php/20080324/en
try this:
http://weblogs.asp.net/scottgu/archive/2006/02/22/Awesome-ASP.NET-2.0-RSS-Tool_2D00_Kit-Released.aspx
<asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">
<ItemTemplate>
Title: <%# XPath("title") %><br />
Pulish Date: <%# XPath("pubDate") %><br />
Description: <%# XPath("description") %>
<hr />
</ItemTemplate>
Related
I followed this tutorial Use external RSS feed in ASP.NET website - Visual Studio 2010
To try and display a Facebook rss feed on my website.
This was the resulting code:
<form id="form1" runat="server">
<div>
<asp:ListView ID="ListView1" runat="server" DataSourceID="XmlDataSource1">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<li><%#XPath("title") %></li>
</ItemTemplate>
</asp:ListView>
</div>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="http://feeds.bbci.co.uk/news/rss.xml?edition=uk"
XPath="rss/channel/item"></asp:XmlDataSource>
</form>
With nothing in the codebehind file.
This seem to work with pretty much any RSS feed. But if I try with my Facebook RSS feed:
http://www.facebook.com/feeds/page.php?format=rss20&id=1425042407719904
It falls over with the following error:
An error occurred while parsing EntityName. Line 9, position 30.
Is there something extra needs doing when consuming/parsing a Facebook RSS feed?
Thanks.
Ok. Never did find the reason for this. In the end I routed the feed via feedburner.com which seemed to resolve the issue.
What I am trying to achieve is to get the full path of the images, assigning them to the source attribute of the HTML image control. This image is placed within a Repeater Control.
Here the code:
<asp:Repeater runat="server" ID="flashImagesRepeater" >
<HeaderTemplate>
<table>
<tr id="bodyImagesTr" >
<td>
</HeaderTemplate>
<ItemTemplate>
<sc:Link ID="flashImageClickURL" runat="server" Field="Click Url" Item="<%# Container.DataItem %>" >
<img id="htmlImage" runat="server" field="Image" src="<%# MediaManager.GetMediaUrl(((ImageField)((Item)Container.DataItem).Fields["Image"]).MediaItem) %>" />
</sc:Link>
</ItemTemplate>
<FooterTemplate>
</td>
</tr>
</table>
</FooterTemplate>
Also made sure that I have the relevant namespace added <%# Import Namespace="Sitecore.Resources.Media" %> at the top.
But VS2010 gives me the error
Cannot resolve symbol 'MediaItem'
Can someone guide me as to what am I doing wrong?
May be the brackets are being being placed incorrectly?
Thanks for reading.
You definitely don't need to write anything in the code behind. It looks like for some reason one of the classes in you statement is considered as not from the one of the Sitecore namespaces. Try to use full class names with namespaces:
<img
id="htmlImage"
runat="server"
field="Image"
src="<%# Sitecore.Resources.Media.MediaManager.GetMediaUrl(((Sitecore.Data.Fields.ImageField)((Sitecore.Data.Items.Item)Container.DataItem).Fields["Image"]).MediaItem) %>"
/>
Looks like you're trying to render an image from a field in an item, just use the FieldRender control and let Sitecore handle it.
<sc:FieldRenderer runat="server" FieldName="Image" Item="<%# (Item)Container.DataItem %>" />
I think the problem you are having is that there is that ImageField is not resolving to the Sitecore image field correctly. I pasted that code into an aspx page and I got another error saying that the Field could not be cast as an ImageField. So I added the sitecore name space to the ImageField conversion and it properly intellisensed MediaItem as you wanted.
So change the image tag to this and it should work:
<img id="htmlImage" runat="server" field="Image" src="<%# MediaManager.GetMediaUrl(((Sitecore.Data.Fields.ImageField)((Item)Container.DataItem).Fields["Image"]).MediaItem) %>" />
Personally tho - I would use the Sitecore Image control to render the image, if you just want to find the media Url in back end code, the above code would work but could be written a lot more readable :)
Hope this helps!
I used Html Editor with firefox on my pc. I switched pcs and I tested my site again.. The HTML editor appears completely messed up across browsers ..It doesnt even look as good as it
is on the original pc i deployed it.
The question is why? And should I use ajax at all instead of jquery?
All the pages markup:
<%# Page Title="" Language="C#" MasterPageFile="~/YourGuruMaster.master" AutoEventWireup="true" CodeFile="PostEdit.aspx.cs" Inherits="PostEdit" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit.HTMLEditor" tagprefix="cc1" %>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>
<cc1:Editor
ID="Editor1"
Width="850px"
Height="400px"
runat="server"/>
<br />
<asp:Button
id="btnSubmit"
Text="Submit"
Runat="server" onclick="btnSubmit_Click" />
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="Editor1" ErrorMessage="אין להשאיר שדות רקים"
ForeColor="#CC0000"></asp:RequiredFieldValidator>
1.) This is a much deeper problem. You probably need to add more rules to your css stylesheet. If you want the site to look the same across different browsers, you have to look into cross browser support and cross browser compatibility.
2.) The jQuery library has a full suite of AJAX capabilities. There is no need to use self-made js functions to create AJAX calls. Stick with jQuery.
I would like to know how to work with the
<%$ %>
format in aspx pages, as I see that it can be used in all kind of formats to insert server side values to controls.
How does its called?
And where can I please read about how to use it, and what are the format options in all kind of controls.
Thanks.
They are ASP.NET Expressions.
A very common usage is when using a resource file, like so
<asp:Label id="label1" runat="server" text="<%$ Resources: Messages, ThankYouLabel %>" />
Read more on them here: http://msdn.microsoft.com/en-us/library/d5bd1tad.aspx
I saw in a lot of AjaxControlToolkit.resources.dll for different languages, even mine (Russian) in my bin folder so I guess that's real to change the language of my Ajax Calendar Extender.
<asp:TextBox ID="TextBox4" runat="server" oninit="TextBox4_Init" />
<ajaxToolkit:CalendarExtender ID="TextBox4_CalendarExtender" runat="server"
Enabled="True" FirstDayOfWeek="Monday" Format="dd.MM.yyyy"
TargetControlID="TextBox4" />
<br />
It's English by default
But how can I change it to my Language ? (or to the current culture language)
I've tried
<%# Page Title="gfregrhtrhr" Language="Nemerle" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
CodeBehind="Report.aspx.n" Inherits="Flow_WEB_Nemerle.Report" Culture="ru-RU" UICulture="ru-RU" %>
but it made no sense for calendar :-/
by the way I have some fun in comparing my page and
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Calendar/Calendar.aspx
there I can see month names etc on Russian BUT "Today" an english >_< instead on my page month names are English and "Today" is Russian "Сегодня" ... is it phenomenon
Finally fixed by adding
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnableScriptGlobalization="true" EnableScriptLocalization="true"/>
The components are going to work by default in the language defined in the page culture property in your page directive. This directive also fix the date format and all the culture relative parameters and preferences.
This is an example to set them work for English-United Kingdom:
<%# Page Language="C#" Culture="en-UK" UICulture="en-UK" %>
You must set EnableScriptGlobalization="true" in ToolkitScriptManager like this
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnableScriptGlobalization="True"></asp:ToolkitScriptManager>