webgrid, RebindDataSource, InitializeDataSource, InitializePostBack

1 reply. Last post: December 4, 2009 4:32 AM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Our application is using Webgrid 4.0. I am trying to adapt it to WebGrid 7.0.
I am having problems with converting the code in the InitializeDataSource and InitializePostBack.
The code below was used in 4.0 to bind a dataset to the grid. Since in 7.0 the InitalializeDatSource event must return a Dataset, where am I suppose to call the ReBindDataSource? I did not see any sample code showing where it should be used. 
And since ClearCachedDataSource() followed by RebindDataSource() will recall InitializeDataSource I will be in a recursive loop!
Unless InitializeDataSource does a RebindDataSource automatically?
Can you help me clarify these issues?
		Private Sub InitializeDataGrid()
			Dim objDS As DataSet = clsSubCertification.GetPackages(intExecutiveID, intPeriodID)
			With dgPackages
				'Assign Data
				.ClearCachedDataSource()
				.DataSource = objDS
				
				.DataMember = objDS.Tables(0).TableName
				.RebindDataSource()
	

				.RootTable.SelfReferencingSettings.Enabled = True
				.RootTable.SelfReferencingSettings.ChildDataMember = "ManagerID"
				.RootTable.SelfReferencingSettings.ParentDataMember = "UserID"
						.RootTable.SelfReferencingSettings.LoadOnDemand = False
				.RootTable.SelfReferencingSettings.ExpandColumnMember = "FullName"
				.RootTable.SelfReferencingSettings.ExpandColumnInnerTextPadding = 4
				.RootTable.SelfReferencingSettings.FitColumnOnExpand = True
			End With
			
		End Sub
All times are GMT -5. The time now is 1:41 AM.
Previous Next