Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8913989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:36:38+00:00 2026-06-15T04:36:38+00:00

I am fairly new to ASP.NET (PHP programmer for 8 years), so please forgive

  • 0

I am fairly new to ASP.NET (PHP programmer for 8 years), so please forgive me if my terminology is incorrect.

I am currently grabbing a remote XML file in a repeater XMLDataSource, and the DataFile attribute is being set in the code behind (I have the DataFile dynamically change based on URI parameters such as ?cat=blah etc). This works beautifully and is not a problem.

Within this repeater is a <asp:HyperLink>, whose URL is to be dynamically changed in the code behind as well.

Now to the question:

From the code behind, how can I see if XML nodes are empty, and how can I grab the value of nodes that are not?

I have been on this issue for about 3 days now (hours of searching), however I just cannot figure out something that seems like it should be so simple! Here is the code I currently have, however I am given an error of Object reference not set to an instance of an object for the code behind line that has CreateNavigator();

Hopefully somebody more adept than me with ASP.NET and C# can easily spot the problem or knows of a way I can accomplish this?

Code

<asp:XmlDataSource ID="rssFeed" runat="server"></asp:XmlDataSource>
<asp:Repeater runat="server" DataSourceID="rssFeed" OnItemDataBound="Repeater_ItemDataBound">
        <ItemTemplate>
                <asp:HyperLink ID="articleURL" Text='<%#XPath("title")%>' runat="server" />
        </ItemTemplate>
</asp:Repeater>

Code behind C#

protected void Page_Load(object sender, EventArgs e)
{
        // rss variables
        var rssSource = "http://websiteurl.com/xmlfeed/";
        var rssPath = "rss/channel/item";
        var searchQueries = "?foo=bar";
        string currCat = Request.QueryString["cat"];
        string searchTerms = Request.QueryString["s"];

        // insert categories query
        if(currCat != null){
                searchQueries += "&cat=" + currCat;
        }

        // insert search query
        if(searchTerms != null){
                searchQueries += "&s=" + searchTerms;
        }

        // load RSS file
        rssFeed.DataFile = rssSource + searchQueries;
        rssFeed.XPath = rssPath;
}

protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
        XPathNavigator nav = ((IXPathNavigable)e.Item.DataItem).CreateNavigator();
        string hyperlinkURL = nav.SelectSingleNode("link").Value;
        // removed code here that changes URL to hyperlinkURL to shorten post
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:36:40+00:00Added an answer on June 15, 2026 at 4:36 am

    For those who may be interested in this as well, I found a solution where I can easily check and manipulate xml items.

    protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        // make sure we are not checking item in ItemHeader or ItemFooter to prevent null value
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
            string myVar = XPathBinder.Eval(e.Item.DataItem,"title").ToString();
    
            // utilize and manipulate myVar XML value here
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to asp.net/c# and very new to jQuery so please forgive me
Im fairly new to Asp.Net arena here guys,so please bear with me if say
I am fairly new to ASP.NET MVC and working on a small project in
I am fairly new to ASP.NET and I discovered repeaters recently. Some people use
So I am fairly new to ASP.NET MVC and Windows Live Connect API. Basically
I'm fairly new to ASP.NET and as a self-chosen assignment I am to create
I am fairly new to C# and ASP.NET. I am working on an existing
I'm fairly new to VB.NET, and I've mainly been doing ASP programming up 'til
I'm fairly new to asp.net MVC3. I followed the link below http://blogs.msdn.com/b/rickandy/archive/2011/05/02/securing-your-asp-net-mvc-3-application.aspx it all
I'm fairly new to ASP.NET MVC and I've got a problem with Html.TextBoxFor() -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.