You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,54 @@
|
||||
namespace System.Web.DynamicData.Util {
|
||||
using System;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Resources;
|
||||
using System.Globalization;
|
||||
using IDataBoundControlInterface = System.Web.UI.WebControls.IDataBoundControl;
|
||||
|
||||
internal static class DataControlHelper {
|
||||
internal static IDynamicDataSource FindDataSourceControl(Control current) {
|
||||
for (; ; current = current.NamingContainer) {
|
||||
// Don't look further than the Page, or if the control is not added to a page hierarchy
|
||||
if (current == null || current is Page)
|
||||
return null;
|
||||
|
||||
IDataBoundControlInterface dataBoundControl = GetDataBoundControl(current, false /*failIfNotFound*/);
|
||||
|
||||
// Not a data control: continue searching
|
||||
if (dataBoundControl == null) {
|
||||
continue;
|
||||
}
|
||||
// Return its DynamicDataSource
|
||||
return dataBoundControl.DataSourceObject as IDynamicDataSource;
|
||||
}
|
||||
}
|
||||
|
||||
internal static IDataBoundControlInterface GetDataBoundControl(Control control, bool failIfNotFound) {
|
||||
if (control is IDataBoundControlInterface) {
|
||||
return (IDataBoundControlInterface)control;
|
||||
}
|
||||
IDataBoundControlInterface dataBoundControl = null;
|
||||
if (control is Repeater) {
|
||||
dataBoundControl = GetControlAdapter(control);
|
||||
}
|
||||
|
||||
if (dataBoundControl == null && failIfNotFound) {
|
||||
throw new Exception(String.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
DynamicDataResources.DynamicDataManager_UnsupportedControl,
|
||||
control.GetType()));
|
||||
}
|
||||
|
||||
return dataBoundControl;
|
||||
}
|
||||
|
||||
internal static IDataBoundControlInterface GetControlAdapter(Control control) {
|
||||
Repeater repeater = control as Repeater;
|
||||
if (repeater != null) {
|
||||
return new RepeaterDataBoundAdapter(repeater);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user