TableResultControl Class
Represents the tabular query results returned by the ResultControl property.
System.Object
System.Web.UI.Control
System.Web.UI.TemplateControl
System.Web.UI.UserControl
Microsoft.SharePoint.WebControls.PickerResultControlBase
Microsoft.SharePoint.WebControls.TableResultControl
System.Web.UI.Control
System.Web.UI.TemplateControl
System.Web.UI.UserControl
Microsoft.SharePoint.WebControls.PickerResultControlBase
Microsoft.SharePoint.WebControls.TableResultControl
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
TableResultControl
Description
The Microsoft.SharePoint.WebControls.TableResultControl class inherits from the Microsoft.SharePoint.WebControls.PickerResultControlBase class which provides functionality for EntityEditorWithPicker contsruction facilitating the searching of arbitrary data. Class heavily related to the use of this control are the Microsoft.SharePoint.WebControls.EntityEditorWithPicker class, the Microsoft.SharePoint.WebControls.PickerDialog class, and Microsoft.SharePoint.WebControls.SimpleQueryControl class.
TableResultControl functions by using a series of System.Collections.ArrayList properties, namely:
ColumnDisplayNames
ColumnNames
ColumnWidths
to produce a System.Web.UI.WebControls.Table object that can contains the results of a data query used with a PickerDialog.ResultControl.
Usage Scenario
The primary usage of TableResultControl is to provide strongly typed Table generation include formatting for classes that inherit from PickerDialog. When a class is inheriting from PickerDialog, new ArrayList object can be created within the class constructor by casting a TableResultControl type against the PickerDialog.ResultControl, allowing exposure of the described properties.
In the below example, the MyPickerDialog class is inheriting from the PickerDialog class. MyPickerDialog contains a parameterless constructor, however is calling the base constructor passing in a custom MyEntityEditor object which inherits from the EntityEditorWithPicker class and a custom MyCustomQueryControl object which inherits from the SimpleQueryControl class. Following, in the MyPickerDialog constructor, we are building the relevant ArrayList objects for the custom PickerDialog to use by casting with the TableResultControl type against the PickerDialog.ResultControl, allowing the required values to be exposed via their properties.
C# Code Example
public class MyPickerDialog : PickerDialog
{
public MyPickerDialog() : base(new MyCustomQueryControl(), new TableResultControl(), new MyEntityEditor())
{
ArrayList columnDisplayNames = ((TableResultControl)base.ResultControl).ColumnDisplayNames;
columnDisplayNames.Clear();
columnDisplayNames.Add("Name");
ArrayList columnNames = ((TableResultControl)base.ResultControl).ColumnNames;
columnNames.Clear();
columnNames.Add("Name");
ArrayList columnWidths = ((TableResultControl)base.ResultControl).ColumnWidths;
columnWidths.Clear();
columnWidths.Add("100%");
}
}
VB.NET Code Example
Public Class MyPickerDialog
Inherits PickerDialog
Public Sub New()
MyBase.New(New MyCustomQueryControl(), New TableResultControl(), New MyEntityEditor())
Dim columnDisplayNames As ArrayList = DirectCast(MyBase.ResultControl, TableResultControl).ColumnDisplayNames
columnDisplayNames.Clear()
columnDisplayNames.Add("Name")
Dim columnNames As ArrayList = DirectCast(MyBase.ResultControl, TableResultControl).ColumnNames
columnNames.Clear()
columnNames.Add("Name")
Dim columnWidths As ArrayList = DirectCast(MyBase.ResultControl, TableResultControl).ColumnWidths
columnWidths.Clear()
columnWidths.Add("100%")
End Sub
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.TableResultControl class inherits from the Microsoft.SharePoint.WebControls.PickerResultControlBase class which provides functionality for EntityEditorWithPicker contsruction facilitating the searching of arbitrary data. Class heavily related to the use of this control are the Microsoft.SharePoint.WebControls.EntityEditorWithPicker class, the Microsoft.SharePoint.WebControls.PickerDialog class, and Microsoft.SharePoint.WebControls.SimpleQueryControl class.
TableResultControl functions by using a series of System.Collections.ArrayList properties, namely:
ColumnDisplayNames
ColumnNames
ColumnWidths
to produce a System.Web.UI.WebControls.Table object that can contains the results of a data query used with a PickerDialog.ResultControl.
Usage Scenario
The primary usage of TableResultControl is to provide strongly typed Table generation include formatting for classes that inherit from PickerDialog. When a class is inheriting from PickerDialog, new ArrayList object can be created within the class constructor by casting a TableResultControl type against the PickerDialog.ResultControl, allowing exposure of the described properties.
In the below example, the MyPickerDialog class is inheriting from the PickerDialog class. MyPickerDialog contains a parameterless constructor, however is calling the base constructor passing in a custom MyEntityEditor object which inherits from the EntityEditorWithPicker class and a custom MyCustomQueryControl object which inherits from the SimpleQueryControl class. Following, in the MyPickerDialog constructor, we are building the relevant ArrayList objects for the custom PickerDialog to use by casting with the TableResultControl type against the PickerDialog.ResultControl, allowing the required values to be exposed via their properties.
C# Code Example
public class MyPickerDialog : PickerDialog
{
public MyPickerDialog() : base(new MyCustomQueryControl(), new TableResultControl(), new MyEntityEditor())
{
ArrayList columnDisplayNames = ((TableResultControl)base.ResultControl).ColumnDisplayNames;
columnDisplayNames.Clear();
columnDisplayNames.Add("Name");
ArrayList columnNames = ((TableResultControl)base.ResultControl).ColumnNames;
columnNames.Clear();
columnNames.Add("Name");
ArrayList columnWidths = ((TableResultControl)base.ResultControl).ColumnWidths;
columnWidths.Clear();
columnWidths.Add("100%");
}
}
VB.NET Code Example
Public Class MyPickerDialog
Inherits PickerDialog
Public Sub New()
MyBase.New(New MyCustomQueryControl(), New TableResultControl(), New MyEntityEditor())
Dim columnDisplayNames As ArrayList = DirectCast(MyBase.ResultControl, TableResultControl).ColumnDisplayNames
columnDisplayNames.Clear()
columnDisplayNames.Add("Name")
Dim columnNames As ArrayList = DirectCast(MyBase.ResultControl, TableResultControl).ColumnNames
columnNames.Clear()
columnNames.Add("Name")
Dim columnWidths As ArrayList = DirectCast(MyBase.ResultControl, TableResultControl).ColumnWidths
columnWidths.Clear()
columnWidths.Add("100%")
End Sub
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP