thanks
I post the code:
I created linq dbml with some tables
the main of them is
items from where I take the data for the grid
the init function are not so important - they just put the data in the treeview and dropdownlist in the first time the page is load
so we have the filters GUI objects.
ASPX:
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table width="100">
<tr valign="top">
<td width="20%">
<asp:DropDownList ID="DropDownList1" runat="server"
AppendDataBoundItems="True"
AutoPostBack="True">
<asp:ListItem Value="0">Select Designer:</asp:ListItem>
</asp:DropDownList>
<asp:TreeView ID="TreeView1" runat="server" ImageSet="Arrows">
<ParentNodeStyle Font-Bold="True" />
<HoverNodeStyle Font-Underline="True" ForeColor="#6D266A" />
<SelectedNodeStyle Font-Underline="True" ForeColor="#6D266A"
HorizontalPadding="0px"
VerticalPadding="0px" />
<NodeStyle Font-Names="Tahoma" Font-Size="10pt"
ForeColor="#6D266A" HorizontalPadding="5px"
NodeSpacing="0px" VerticalPadding="0px" />
</asp:TreeView>
</td>
<td width="80%">
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="item" >
<Columns>
<asp:BoundField DataField="item" HeaderText="Item" ReadOnly="True"
SortExpression="item" />
<asp:BoundField DataField="itemdesc" HeaderText="Description"
SortExpression="itemdesc" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
code behind (
VB.NET):
Code:
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Using mydata As New TreeTestDataContext()
InitItemClassTree(mydata)
InitDesigners(mydata)
End Using
End If
End Sub
Private Sub InitDesigners(ByRef aDataContext As TreeTestDataContext)
Dim allDesigners = From d In aDataContext.designers _
Order By d.designer _
Select New With {d.id, d.designer}
For Each d In allDesigners
Dim newListItem As New ListItem
newListItem.Value = d.id
newListItem.Text = d.designer
DropDownList1.Items.Add(newListItem)
Next
End Sub
Private Sub InitItemClassTree(ByRef aDataContext As TreeTestDataContext)
Dim allclasses = From c In aDataContext.itemclassesgroups _
Order By c.forder _
Select New With {c.id, c.name, c.itemclasses}
For Each c In allclasses
Dim newExpandNode As New TreeNode
With newExpandNode
.Text = c.name
.Value = c.id
.SelectAction = TreeNodeSelectAction.Expand
.Expanded = False
For Each i As itemclass In c.itemclasses
Dim newSelectNode As New TreeNode
With newSelectNode
.SelectAction = TreeNodeSelectAction.Select
.Text = i.itemclass
.Value = i.id
End With
newExpandNode.ChildNodes.Add(newSelectNode)
Next
End With
TreeView1.Nodes.Add(newExpandNode)
Next
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Using mydata As New TreeTestDataContext
Dim allItemsByDesignerId = From it In mydata.items _
Where it.designerid = DropDownList1.SelectedValue _
Order By it.sortorder _
Select New With {it.item, it.itemdesc}
GridView1.DataSource = allItemsByDesignerId
GridView1.DataBind()
End Using
End Sub
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.SelectedNodeChanged
Using mydata As New TreeTestDataContext
Dim allItemsByClassId = From it In mydata.items _
Where it.itemclassid = TreeView1.SelectedValue _
Order By it.sortorder _
Select New With {it.item, it.itemdesc}
GridView1.DataSource = allItemsByClassId
GridView1.DataBind()
End Using
End Sub
End Class
the error I am getting when pressing on the paging links (2 3 ...)
is this:
Code:
Line: 4723
Error: Sys.WebForms.PageRequestManagerServerErrorException: The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.
what handeling I need to do here? isn't it suppose to be auomatically?
Thanks very much
BARAK