|
-
May 20th, 2003, 10:19 AM
#1
Thread Starter
Hyperactive Member
Formatting RSS Columns in a datagrid
I have an ASP.Net news reader where I syndicate news items from different sites. In my current app I am just streaming the XML and using a XSL file to format the look of the feed.
As an alternative I want to pull the RSS files and parse them with a datagrid like this. The problem I am having is that I don't know how to remove columns I don't want in the grid specificaly the redundant title and the channel id.
Here is the datagrid (without formatting):
Code:
<asp:DataGrid id="rss" runat="server">
<Columns>
<asp:TemplateColumn HeaderText="New Items">
<ItemTemplate>
<a href="<%# DataBinder.Eval(Container.DataItem, "link")%>">
<%# DataBinder.Eval(Container.DataItem, "title") %></a>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Any ideas?
-
May 20th, 2003, 11:07 AM
#2
Frenzied Member
I did a project similar to that. What I did was use a DataList instead of DataGrid. I then put 2 labels and a hyperlink control in the DataList, then binded those controls to the columns in the Rss Feeds that I wanted to display.
-
May 20th, 2003, 11:19 AM
#3
PowerPoster
Try including this:
AutoGenerateColumns="False"
Example:
<asp:DataGrid id="rss" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="New Items">
<ItemTemplate>
<a href="<%# DataBinder.Eval(Container.DataItem, "link")%>">
<%# DataBinder.Eval(Container.DataItem, "title") %></a>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
-
May 20th, 2003, 02:36 PM
#4
Thread Starter
Hyperactive Member
Thanks to both of you for answering my question. Hellswraith that worked perfectly and even worked out a little better then I imagined.
-
May 20th, 2003, 02:56 PM
#5
PowerPoster
The AutoGenerateColumns always messes me up until I go turn it to false. Sometimes my result set contains a lot more columns than what I want displayed, so I always turn it off and specify the columns that I want shown.
Glad to hear that it works. Good luck.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|