-
Why does the GridView control always display previous data? is this a bug of ASP.NET?
Why does the GridView control always display previous data? is this a bug of ASP.NET?
I hope that the GridView control displays different data when I click different the node of the TreeView control.
but the GridView control display the same data when I click different the TreeView control nodes (such as clik Type and Card nodes in Treeview control).
//----------------------------Program Code (You may save it as a ASPX file and run it)--------------------------------
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
if (TreeView1.SelectedNode.Value == "a6dce8fe-749c-4e38-ab2f-3d03d9711b3d")
{
GridView1.DataSourceID = null;
GridView1.DataBind();
}
if (TreeView1.SelectedNode.Value == "b8dcf8fe-749c-4e38-ab2f-6d03d9711b8j")
{
GridView1.DataSourceID = null;
GridView1.DataBind();
XmlDataSource2.Data = @"<UserBookmarks>
<Bookmark Title=""Card""></Bookmark>
</UserBookmarks>";
GridView1.DataSourceID = XmlDataSource2.ID;
GridView1.DataBind();
}
if (TreeView1.SelectedNode.Value == "hkdcf8fe-749c-4e38-ab2f-6d03d9711bfg")
{
GridView1.DataSourceID = null;
GridView1.DataBind();
XmlDataSource2.Data = @"<UserBookmarks>
<Bookmark Title=""Type""></Bookmark>
</UserBookmarks>";
GridView1.DataSourceID = XmlDataSource2.ID;
GridView1.DataBind();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:XmlDataSource ID="XmlDataSource1" runat="server">
<Data>
<Folder Name="Root" Id="a6dce8fe-749c-4e38-ab2f-3d03d9711b3d">
<Folder Name="Card" Id="b8dcf8fe-749c-4e38-ab2f-6d03d9711b8j"/>
<Folder Name="Type" Id="hkdcf8fe-749c-4e38-ab2f-6d03d9711bfg"/>
</Folder></Data>
</asp:XmlDataSource>
</div>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
<DataBindings>
<asp:TreeNodeBinding DataMember="Folder" TextField="Name" ValueField="Id" />
</DataBindings>
</asp:TreeView>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
<asp:XmlDataSource ID="XmlDataSource2" runat="server"></asp:XmlDataSource>
</form>
</body>
</html>
//----------------------------Program Code (You may save it as a ASPX file and run it)--------------------------------
Similar Threads
-
By itchock in forum VB Classic
Replies: 0
Last Post: 06-26-2005, 08:22 AM
-
Replies: 0
Last Post: 10-11-2002, 10:52 AM
-
By Tea in forum VB Classic
Replies: 1
Last Post: 09-10-2002, 08:31 AM
-
By John in forum VB Classic
Replies: 0
Last Post: 10-12-2001, 05:09 PM
-
By Michael C in forum VB Classic
Replies: 1
Last Post: 07-14-2000, 04:45 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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks