Hi There;
I am writing a basic ASP.NET code. This code has worked properly before, but when I has changed "EnableViewState" to false, saved it it and operated it, code didn't work.
When I have changed the "EnableViewState" to true again, it didn't work either.
I couldn't imagine the reason why such a basic code fails. I try to solve problems by programming, but the platform create problems too.
Here is the code:

<%@ import Namespace="System.Data" %>

<%@ Page Language="c#" Debug="true" codePage="28599" %>

<script runat="server">
 void Page_Load(Object Sender, EventArgs e)
{

       DataSet ds = new DataSet();
       ds.ReadXml(Server.MapPath("turlar.xml"));

        DataGrid1.DataSource = ds;
        DataGrid1.DataBind();

}

        </script>
<HTML>
    <HEAD>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
    </HEAD>
    <body>
        <form id="Form1" runat="server">
            <asp:DataGrid runat="server" id="DataGrid1" EnableViewState="True" />
        </form>
    </body>
</HTML>

turlar.xml defined in the project directory.
Thanks in advance.

Recommended Answers

All 5 Replies

When I restart the computer, it works only once.

I changed my default browser to chrome, and it works.

I guess you r just showing the data in grid.Is it not showing when refreshed.Can u elaborate the problem.

Yes, there is a data in my xml file, and I show it in grids. When my default browser is internet explorer, browser simply doesn't reply, the code doesn't initiate. There is not any issue with refreshing. I changed my default browser
to google chrome, and it works and refreshes.

One basic thing i should share that put your Data loading code in Page Load event under Not Page.IsPostback condition.This ensures data binding at one time loading and refrains unnecessary problems,the real issue may be not of this.
Can you debug at Line 10 and see what Server.MapPath is returning.Maybe there can be front slash/back slash separator issue and the XML path is not being parsed properly and so cant be read in IE.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.