0

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.

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by sebastian3
0

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

0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.