How to fill grid in asp.net through code in function of class

How to fill grid in asp.net through code in function of class

 Public Function FillGrid() As DataTable  
 Dim cmd As SqlCommand  
 cmd = New SqlCommand("SP_SELECT_COLUMNNAMES", objCn.openDb())  
 cmd.CommandType = CommandType.StoredProcedure  
 Dim dt As New DataTable("Dt")  
 Dim da As New SqlDataAdapter(cmd)  
 Try  
 cmd.Parameters.Add(New SqlParameter("@COLUMNNAME", SqlDbType.VarChar, 1000, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, _ColumnName))  
 cmd.Parameters.Add(New SqlParameter("@TABLE", SqlDbType.Char, 300, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, _Table))  
 cmd.Parameters.Add(New SqlParameter("@CRITERIA", SqlDbType.Char, 2000, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, _Criteria))  
 'Execute Query  
 da.Fill(dt)  
 'da.Fill(dt)  
 Dim Inti As Integer  
 'For Inti = 0 To dt.Columns.Count - 1  
 ' 'dt.Columns(Inti).ReadOnly = True  
 'Next  
 Dim intj As Integer  
 For Inti = 0 To dt.Rows.Count - 1  
 For intj = 0 To dt.Columns.Count - 1  
 dt.Rows(Inti).Item(intj) = dt.Rows(Inti).ItemArray(intj).ToString().Trim()  
 Next  
 Next  
 Return dt  
 Catch ex As Exception  
 MsgBox("clsCommon::FillGrid::Error occured.", MsgBoxStyle.Critical, "SBP")  
 Finally  
 objCn.closeDb()  
 cmd.Dispose()  
 End Try