TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mohammed shamsheer
NA
394
144.3k
how to implemnet scrolling news from xml in to asp.net page
Jul 1 2013 2:03 AM
This is my code behind page...when i load xml content to label in asp.net page only table[0][0] index is loaded i want to load whole xml content in to my asp page...like paragraph format....my idea to implent scrollin news in my webpage.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Data;
public partial class NewsEventsUsingXML : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Bind xml data to datalist
BindDatalist();
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
XmlDocument XmlTxt = new XmlDocument();
XmlTxt.Load(Server.MapPath("XMLFile2.xml"));
XmlElement ParentElement = XmlTxt.CreateElement("News1");
XmlElement News = XmlTxt.CreateElement("News");
News.InnerText = txtNews.Text;
ParentElement.AppendChild(News);
XmlTxt.DocumentElement.AppendChild(ParentElement);
XmlTxt.Save(Server.MapPath("XMLFile2.xml"));
}
private void BindDatalist()
{
XmlTextReader XmlReader1 = new XmlTextReader(Server.MapPath("XMLFile2.xml"));
DataSet Xmlds1 = new DataSet();
Xmlds1.ReadXml(XmlReader1);
XmlReader1.Close();
lblNews.Text = Xmlds1.Tables[0].Rows[0][0].ToString();
lblNews.Text=Xmlds1.Tables[0].Rows[1][0].ToString();
lblNews.Text = Xmlds1.Tables[0].Rows[6][0].ToString();
lblNews.DataBind();
//GridView1.DataSource = Xmlds1;
//GridView1.DataBind();
}
}
Reply
Answers (
12
)
Scaling problem with user control at runtime
Object reference not set to an instance of an object.