T
tshad
I want to use the same code for my DataGrid item as I do for my DataList
Item. The only difference is the data type. Is there a generic data type I
can use?
I have a datagrid inside of my data list and want to be able to select
either the dataListItem or the dataGridItem and do exactly the same thing.
For example, instead of:
Dim oDGI as DataGridItem = s.parent.parent
Dim oGrid as DataGrid = oDGI.parent.parent
Dim Answer as Label = CType(oDGI.FindControl("lblAnswer"),Label)
for each oDGI2 as DataGridItem in oGrid.Items
and
Dim oDLI as DataListItem = s.parent.parent
Dim oList as DataGrid = oDLI.parent.parent
Dim Answer as Label = CType(oDLI.FindControl("lblAnswer"),Label)
for each oDLI2 as DataListItem in oList.Items
(which same except for the object names)
Is there a way to do something like:
******************************************************
Dim oDI as DataItem ' generic DataItem
Dim oDI2 as DataItem ' generic DataItem
Dim oGridorList as ?
Dim oDLI as DataListItem
Dim oDGI as DataGridItem
if (s.id = "btnGrid") then
Dim oDGI as DataGridItem = s.parent.parent
oDI = oDGI
Dim oGrid as DataGrid = oDGI.parent.parent
oGridorList = oGrid
end if
if (s.id = "btnList") then
oDLI = s.parent.parent
oDI = oDLI
Dim oList as DataList = oDLI.parent.parent
oGridorList = oList
end if
Dim Answer as Label = CType(oDI.FindControl("lblAnswer"),Label)
for each oDI2 as DataItem in oGridorList.Items
********************************************************************
Not sure if this can be done, but it would help me to not duplicate my code.
Thanks,
Tom
Item. The only difference is the data type. Is there a generic data type I
can use?
I have a datagrid inside of my data list and want to be able to select
either the dataListItem or the dataGridItem and do exactly the same thing.
For example, instead of:
Dim oDGI as DataGridItem = s.parent.parent
Dim oGrid as DataGrid = oDGI.parent.parent
Dim Answer as Label = CType(oDGI.FindControl("lblAnswer"),Label)
for each oDGI2 as DataGridItem in oGrid.Items
and
Dim oDLI as DataListItem = s.parent.parent
Dim oList as DataGrid = oDLI.parent.parent
Dim Answer as Label = CType(oDLI.FindControl("lblAnswer"),Label)
for each oDLI2 as DataListItem in oList.Items
(which same except for the object names)
Is there a way to do something like:
******************************************************
Dim oDI as DataItem ' generic DataItem
Dim oDI2 as DataItem ' generic DataItem
Dim oGridorList as ?
Dim oDLI as DataListItem
Dim oDGI as DataGridItem
if (s.id = "btnGrid") then
Dim oDGI as DataGridItem = s.parent.parent
oDI = oDGI
Dim oGrid as DataGrid = oDGI.parent.parent
oGridorList = oGrid
end if
if (s.id = "btnList") then
oDLI = s.parent.parent
oDI = oDLI
Dim oList as DataList = oDLI.parent.parent
oGridorList = oList
end if
Dim Answer as Label = CType(oDI.FindControl("lblAnswer"),Label)
for each oDI2 as DataItem in oGridorList.Items
********************************************************************
Not sure if this can be done, but it would help me to not duplicate my code.
Thanks,
Tom