ASP.Net - DataType Checking and Validating

Data type checking

1
2
3
if aCol.datatype is system.type.gettype("System.String") then 
aCol.DataType=system.type.gettype("System.Decimal")
end if

Detecting Variable types:

You can tell a variable type using the typename function. For example in the Command window type in

1
? typename(gv.Columns(theGVColNdx))

Object Checking

1
2
3
Dim uc_RecurrancePattern As uc_RecurrancePattern_v2 _
= TryCast(lv.FindControl("uc_RecurrancePattern"), uc_RecurrancePattern_v2)

TryCast wont throw an error, instead it will return nothing