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 9012067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:54:07+00:00 2026-06-16T02:54:07+00:00

i am a starter at asp and while trying to do some table dynamic

  • 0

i am a starter at asp and while trying to do some table dynamic updates i got stuck with a strange issue:
first on page load i take some data from xml file and add it to my table. this part did not cause any problem and the data is shown on the page.
the second part is when i try to write the table’s updated data back to the file, there i get back an empty file. after looking at the values in the debug mode it seems that when i get the HtmlTable instance and check the Row attribute there is only one row which is the header row.

attaching the table declaration:

<table id="users" class="ui-widget ui-widget-content" runat="server">     
<thead> 
<tr class="ui-widget-header ">          
<th>Title</th>                       
<th>Link From Ibms</th> 
<th>Dismiss</th>    
</tr> 
</thead>   
</table>

and the reading and writing function on the server:

 private void readLinkXml()
    {
        if (!File.Exists(path))                                                          //   no file.
            return;

        XmlTextReader reader = new XmlTextReader(path);
        reader.WhitespaceHandling = WhitespaceHandling.None;
    //    reader.Read();

        while (!reader.EOF)                                                              //  load loop
        {

            if ((reader.Name == "ChannelMap" && !reader.IsStartElement()))
            {
                break;
            }

            while ((reader.Name != "links" || !reader.IsStartElement()))
                reader.Read();                                                          // advance to next <links> tag

            HtmlTableRow row = new HtmlTableRow();

            HtmlTableCell title = new HtmlTableCell();
            title.InnerHtml = reader.GetAttribute("TITLE");                             // get link title.
            row.Cells.Add(title);
            HtmlTableCell link = new HtmlTableCell();
            link.InnerHtml = reader.GetAttribute("VOD_URL");                            // get link url.
            row.Cells.Add(link);
            HtmlTableCell buttonCell = new HtmlTableCell();
            buttonCell.Attributes.Add("id", "table_button");
            row.Cells.Add(buttonCell);

            users.Rows.Add(row);                                                        //  add xml asset as row in link table.                         
            reader.Read();                                                              // and now either at <links> tag or </ChannelMap
        }


        reader.Close();
    }


    private void writeLinksXml()
    {
        XmlWriterSettings settings = new XmlWriterSettings();
        settings.Indent = true;
        settings.IndentChars = "  ";
        settings.NewLineChars = "\r\n";
        settings.NewLineHandling = NewLineHandling.Replace;
        XmlWriter writer = XmlWriter.Create(path, settings);

        writer.WriteStartDocument();
        writer.WriteStartElement("ChannelMap");

        bool first = true;

        foreach (HtmlTableRow row in users.Rows)
        {
            if (first)
            {
                first = false;
                continue;
            }

            writer.WriteStartElement("links");
            writer.WriteAttributeString("TITLE", row.Cells[0].InnerText);
            writer.WriteAttributeString("VOD_URL", row.Cells[1].InnerText);
            writer.WriteEndElement();
        }

        writer.WriteEndElement();
        writer.WriteEndDocument();
        writer.Close();
    }  

does anyone knows why i am not able to retrieve the data i just added to the table?

thanks,
moshe

  • 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-16T02:54:08+00:00Added an answer on June 16, 2026 at 2:54 am

    Well, It seems with the issue as all called Why view-state is required in aspnet.
    From your question I guess that you have bind Data in Page_Load() and you may also have used

    Page.IsPostBack
    

    which is good thing to do.

    Now when you do post back you need to make sure that you are binding the same control ( It doesn’t matter what it is GridView,DataList anything…).

    So Bind Again after each Postback or put your data in ViewState if you want to reduce calls with the XML File.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my simple starter asp page I create a DataTable and populate it with
I have been developing websites with ASP.NET for quite a while. When I first
I've got a relatively small project written in ASP.NET MVC3. After working a while,
I have an ASP.NET page where a request is made and after a while
Trying to get an ASP application deployed; it worked for a while but then
1) A while ago I’ve started learning Asp.Net, but then I’ve heard that Ajax
I've just started using ASP, so while programming the code behind in C# I
While developing my ASP.NET MVC, I have started to see the need for a
Can anyone suggest where can I find good starter videos for ASP.NET MVC (other
Are there any VS template/Starter Kit/Any example of an ASP.NET Web Application, which uses

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.