private DataSourceView ConnectToDataSourceView()
{
if (!this._currentViewValid || base.DesignMode)
{
if ((this._currentView != null) && this._currentViewIsFromDataSourceID)
{
this._currentView.DataSourceViewChanged -= new EventHandler(this.OnDataSourceViewChanged);
}
IDataSource source = null;
string dataSourceID = this.DataSourceID;
if (dataSourceID.Length != 0)
{
Control control = DataBoundControlHelper.FindControl(this, dataSourceID);
if (control == null)
{
throw new HttpException(SR.GetString("DataControl_DataSourceDoesntExist", new object[] { this.ID, dataSourceID }));
}
source = control as IDataSource;
if (source == null)
{
throw new HttpException(SR.GetString("DataControl_DataSourceIDMustBeDataControl", new object[] { this.ID, dataSourceID }));
}
}
if (source == null)
{
source = new ReadOnlyDataSource(this.DataSource, this.DataMember);
}
else if (this.DataSource != null)
{
throw new InvalidOperationException(SR.GetString("DataControl_MultipleDataSources", new object[] { this.ID }));
}
DataSourceView view = source.GetView(this.DataMember);
if (view == null)
{
throw new InvalidOperationException(SR.GetString("DataControl_ViewNotFound", new object[] { this.ID }));
}
this._currentViewIsFromDataSourceID = this.IsBoundUsingDataSourceID;
this._currentView = view;
if ((this._currentView != null) && this._currentViewIsFromDataSourceID)
{
this._currentView.DataSourceViewChanged += new EventHandler(this.OnDataSourceViewChanged);
}
this._currentViewValid = true;
}
return this._currentView;
}
能不能给我详细解释上面代码的意思