
October 12th, 2001, 09:44 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,578
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
Databinding - ITEMTEMPLATE problem
Originally posted by : Gerard Mark (gerard@cosmoweb.net)This problem surfaced when I added 3 or more panels to the same webform. The page starts with 'panel1' as the only visible panel which contains a datagrid with an itemtemplate. Panels 2 & 3 are made visible when you click on the links at the top of the page. If I click on Panel 2 and then Panel 3 & then back to Panel 1, the datagrid in 'panel1' looses its data. If I click on Panel 2 and then Panel 1 , or click Panel 3 and the return to Panel 1, I don't have that problem. What's wrong here. See code below.Gerardgerard@cosmoweb.net '************************************************* ****** Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If Not Page.IsPostBack then Dim DataConn As OleDbConnection Dim oDS As New DataSet() DataConn = NewOleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:ProgramFilesMicrosoft OfficeOfficeSamplesNorthwind.mdb;Persist SecurityInfo=False")DataConn.Open()Dim da As OleDbDataAdapterda = New OleDbDataAdapter("Select * from Categories",DataConn) da.Fill(oDS, "Categories") DataGrid1.Datasource = Ods.Tables("Categories").defaultviewDataGrid1.DataBind()DataConn.Close() End if End Sub Public Sub showPanel1(sender As Object, e As EventArgs) Panel2.Visible = False Panel3.Visible = False Panel1.Visible = True End Sub Public Sub showPanel2(sender As Object, e As EventArgs) Panel1.Visible = False Panel3.Visible = False Panel2.Visible = True End Sub Public Sub showPanel3(sender As Object, e As EventArgs) Panel1.Visible = False Panel2.Visible = False Panel3.Visible = True End Sub Databinding Example Panel 1 Panel 2 Panel 3 This is panel 2! This is panel 3!
|