C
Chuck P
I am creating a control which inherits from the GridView.
I want to have an event that adds a new row to the ODS before the GridView
binds.
I was thinking of doing this:
private void AttachDataSourceEvent()
{
ObjectDataSource ds = GetDataSource() as ObjectDataSource;
if (ds != null)
{
ds.Selected += new
ObjectDataSourceStatusEventHandler(this.OnObjectDataSource_Selected);
}
}
protected void OnObjectDataSource_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (m_addButtonClicked)//Add empty record for the first row to
the LIST
{
List<T> list = (List<T>)e.ReturnValue;
list.Insert(0, new T());
}
}
I think the above code will retrieve the ODS used by the GridView.
However, the code in OnObjectDataSource_Selected was from a Helper Class
that new what the ODS DataObjectType was. Now I am having trouble getting
what the object type used is. I can get the ODS
DataObjectTypeName="GridViewHelperTestObjects+TestRow"
but I don't know how to convert this type of syntax to a Type.
I want to have an event that adds a new row to the ODS before the GridView
binds.
I was thinking of doing this:
private void AttachDataSourceEvent()
{
ObjectDataSource ds = GetDataSource() as ObjectDataSource;
if (ds != null)
{
ds.Selected += new
ObjectDataSourceStatusEventHandler(this.OnObjectDataSource_Selected);
}
}
protected void OnObjectDataSource_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (m_addButtonClicked)//Add empty record for the first row to
the LIST
{
List<T> list = (List<T>)e.ReturnValue;
list.Insert(0, new T());
}
}
I think the above code will retrieve the ODS used by the GridView.
However, the code in OnObjectDataSource_Selected was from a Helper Class
that new what the ODS DataObjectType was. Now I am having trouble getting
what the object type used is. I can get the ODS
DataObjectTypeName="GridViewHelperTestObjects+TestRow"
but I don't know how to convert this type of syntax to a Type.