T
tshad
I am using sample code from C# and am trying to convert it to VB.Net in my
aspx page.
This works in C#:
DataGrid oGrid = (DataGrid)oItem.FindControl("DataGrid1");
I have tried all kinds of combinations trying to get it to work:
***********************************************************************
Dim oGrid as DataGrid
oGrid =
CType(DataGrid,DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me this error:
'DataGrid' is a type and cannot be used as an expression.
**************************************************************************************************
*****************************************************************************************************
Dim oGrid as DataGrid
oGrid = DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me this error:
Value of type 'System.Web.UI.WebControls.DataListItemCollection' cannot be
converted to 'System.Web.UI.WebControls.DataGrid'.
****************************************************************************************************
***********************************************************************************************************
Dim oGrid as DataGrid =
DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me:
Identifier expected.
**************************************************************************************************************
***************************************************************************************************************
Dim oGrid as new DataGrid =
DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me:
End of statement expected.
**************************************************************************************************************
How do I make this work?
Thanks,
Tom.
aspx page.
This works in C#:
DataGrid oGrid = (DataGrid)oItem.FindControl("DataGrid1");
I have tried all kinds of combinations trying to get it to work:
***********************************************************************
Dim oGrid as DataGrid
oGrid =
CType(DataGrid,DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me this error:
'DataGrid' is a type and cannot be used as an expression.
**************************************************************************************************
*****************************************************************************************************
Dim oGrid as DataGrid
oGrid = DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me this error:
Value of type 'System.Web.UI.WebControls.DataListItemCollection' cannot be
converted to 'System.Web.UI.WebControls.DataGrid'.
****************************************************************************************************
***********************************************************************************************************
Dim oGrid as DataGrid =
DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me:
Identifier expected.
**************************************************************************************************************
***************************************************************************************************************
Dim oGrid as new DataGrid =
DataList1.Items[DataList1.SelectedIndex].FindControl("DataGrid1"))
Gives me:
End of statement expected.
**************************************************************************************************************
How do I make this work?
Thanks,
Tom.