Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Displaying XML with ASP.NET

    Hello again,
    I said in my first post that I would be back when I find myself stuck again, well...I'm stuck again.

    Kind of at least. I haven't gotten to the point of being stuck since I need a point in the right direction first.

    My project is pretty big for a first time go at. I've been studying many different aspects of coding at once...C#, VB, Razor, Javascript, CSS, jQuery, XML and ASP.NET to be precise. My head is swimming, but in a good way. This is fun.

    Now, enough of that. My next goal is finding the best way to go about displaying XML as HTML. In my ASP.NET studies, I've read about the neat @render function to create layout pages. It was a big step in the right direction. I'm trying to find a way to play off that.

    A big part of my project is a database of articles. Each article shares the common sections 'title,' 'date,' 'author,' 'category,' and 'content.' I'd like to create an article layout page, then have it refer to a particular XML sheet for each article and replace the corresponding divisions on the layout page with the correct sections of the article.

    I'm not sure if this makes sense here, I can see it in my head though. Is there some way to make a @render type function pull information from the XML and place it in it's correct spot on the page?

    I just recently heard about XSLT, but I do not know enough about it yet to know if this will be useful. I will continue my reading in the meantime.

    Any feedback, or a friendly point in the right direction will be greatly appreciated.

    Thanks,
    Bill

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,175
    Thanks
    23
    Thanked 601 Times in 600 Posts
    bdenny20 trying to learn more then one coding program at a time will make you the proverbial "Jack of all trades, master of none".

    Go here to learn xsl and xml for that matter.
    http://www.w3schools.com/xsl/xsl_languages.asp

  • #3
    New Coder
    Join Date
    Jan 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ha, right?
    Probably not the best approach, but every time I start reading up on something, I usually get a warning that I must have a basic understanding of 'X' concepts. I just can't resist.

    There is a bright side though, I'm not cornering myself. I'm picking up and learning new techniques by the hour, less than even. I've finally gotten ContentPlaceHolders under control, and it looks like it's doing exactly what I was trying to accomplish. No XML, but this still works like a charm.



    P.S. My bad sunfighter, I thought that last part was part of your signature. That's the exact same resource I was reading. In fact, 80% of my reading comes from w3schools. Neat site there!
    Last edited by bdenny20; 01-29-2013 at 07:05 PM.

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    learning .net myself too. I suspect you need to look at the XmlDataSource control. This page is out of date but it gets the idea across in a simple way.
    http://www.codeproject.com/Articles/...l-in-ASP-NET-2

  • #5
    New Coder
    Join Date
    Jan 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the heads up man!
    Do you know if this is the most up-to-date way to do something like this? I've been harked at once here already for using old, out-of-date techniques, and I don't want to be there again...

    Regardless, I'll read up on this. So much homework to do.

  • #6
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    i cant answer best practice questions, but i use visual studio 10 with .net 4.0 and it's still a valid control in VS10, so im sure it's fine. No one else has piped up so I hope this helps.
    ( I spend alot of time on MSDN these days)

    - oh ther is an asp.net forum btw, might wanna try there in regards to best practice or use of xmldatasource
    Last edited by DanInMa; 01-30-2013 at 07:24 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •