7 Replies - 1598 Views - Last Post: 14 June 2009 - 11:26 PM Rate Topic: -----

#1 |337BuNNy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 26-May 09

DataList control?

Posted 12 June 2009 - 12:46 AM

Hi Im stuck here. I dono how to explain this but thought this would be this place if I needed help.

this is my .ascx.cs

	protected void LoadRssFeed(string url,int rssCounter)
	{
		try
		{
			GenericRssChannel c = GenericRssChannel.LoadChannel(url);
			Repeater1.DataSource = c.Items;
			Repeater1.DataBind();

and here the ascx

<div class="default" style="height:60px;" >
								  <DIV ID="TICKER"	STYLE="display:none; border-top:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; overflow:hidden; background-color:#FFFFFF; width:520px" onmouseover="TICKER_PAUSED=false" onmouseout="TICKER_PAUSED=false">
								   <asp:Repeater ID="Repeater1" runat="server">
									 <ItemTemplate>
									   <span style='background-color:#7FB51A;'> &nbsp; &nbsp; <font color=#FFFFFF> 
										<B><%# [color=#FF0000]......[/color]%></B></font>&nbsp; &nbsp; 
									   </span> &nbsp; 
									   <B></B>&nbsp;
									 </ItemTemplate>
								  </asp:Repeater>
								  </DIV>
							  </div>


Okay the part that I'm stuck with is ...... Theres a string in c.Items atributes called "title", what do i need to add to ...... to display that string there? I've just started programming so sry If I dont make sense.

but this is what I tried
DataBinder.Eval(Container.DataItem("title"))


I know that is wrong can some1 help me pls?

This post has been edited by |337BuNNy: 12 June 2009 - 12:47 AM


Is This A Good Question/Topic? 0
  • +

Replies To: DataList control?

#2 Tiny Grasshopper  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 53
  • Joined: 26-September 06

Re: DataList control?

Posted 12 June 2009 - 12:58 AM

Hi

Add this code to the <ItemTemplate> in the .ascx
<%# DataBinder.Eval(Container.DataItem, "title") %>



eg
<asp:Repeater ID="Repeater1" runat="server">
  <ItemTemplate>
	<%# DataBinder.Eval(Container.DataItem, "title") %>
  </ItemTemplate>
</asp:Repeater>



if you need more help go to
Data Repeater in ASP.NET
Was This Post Helpful? 0
  • +
  • -

#3 |337BuNNy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 26-May 09

Re: DataList control?

Posted 12 June 2009 - 01:25 AM

K its basicly the same as what I had. It still says that DataBinding: 'RssToolkit.GenericRssElement' does not contain a property with the name 'title'. If I put a breakpoint on where it loads on this line Repeater1.DataSource = c.Items;

Then I can see on c.Items; the folowingPosted Image


What am I doing wrong?
Was This Post Helpful? 0
  • +
  • -

#4 Tiny Grasshopper  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 53
  • Joined: 26-September 06

Re: DataList control?

Posted 12 June 2009 - 02:38 AM

Ok according to what I could dig up don't have visual studio in front of me :(.

Your c.Items is a collection of objects. So you need to use a different databinding expression.

so try using
<%# ((GenericRssChannel)Container.DataItem).title%>


Check out What's the deal with Databinder.Eval and Container.DataItem? for more help

This post has been edited by Tiny Grasshopper: 12 June 2009 - 02:38 AM

Was This Post Helpful? 0
  • +
  • -

#5 |337BuNNy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 26-May 09

Re: DataList control?

Posted 12 June 2009 - 02:47 AM

Hasn't worked so far. But I'm looking at the link quick if I can find something. Yes there is more than one value but I want them all to show in a scroller bar. thanks so far.

The problem now is

The type or namespace name 'GenericRssChannel' could not be found (are you missing a using directive or an assembly reference?)

This post has been edited by |337BuNNy: 12 June 2009 - 02:51 AM

Was This Post Helpful? 0
  • +
  • -

#6 Tiny Grasshopper  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 53
  • Joined: 26-September 06

Re: DataList control?

Posted 12 June 2009 - 03:16 AM

Should have probably asked this before but are you using ASP.NET RSS Toolkit or is your GenericRssChannel a class you created yourself ?

To correct the reference error just make sure you've added a reference to the .dll which contains GenericRssChannel class.

Just came across this if you are flexible on the datarepeater you can use http://www.eggheadca...m-feedread.aspx shows how to use ASP.NET RSS Toolkit with a gridview.

This post has been edited by Tiny Grasshopper: 12 June 2009 - 03:52 AM

Was This Post Helpful? 1
  • +
  • -

#7 |337BuNNy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 26-May 09

Re: DataList control?

Posted 12 June 2009 - 03:46 AM

Okay Ive added this to the ascx
<%@ Register Assembly="RssToolkit" Namespace="RssToolkit" TagPrefix="Rss" %>

But now its giving the same error as before eg

'RssToolkit.GenericRssChannel' does not contain a definition for 'title' and no extension method 'title' accepting a first argument of type 'RssToolkit.GenericRssChannel' could be found (are you missing a using directive or an assembly reference?)

pls don't get fed up with me you are helping lots
Was This Post Helpful? 0
  • +
  • -

#8 |337BuNNy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 26-May 09

Re: DataList control?

Posted 14 June 2009 - 11:26 PM

soz bump?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1