Click here to Skip to main content
15,922,166 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to make Column of DataTable Visible False Pin
_AK_7-Feb-07 19:07
_AK_7-Feb-07 19:07 
GeneralRe: How to make Column of DataTable Visible False Pin
varshavmane7-Feb-07 19:13
varshavmane7-Feb-07 19:13 
GeneralRe: How to make Column of DataTable Visible False Pin
_AK_7-Feb-07 19:26
_AK_7-Feb-07 19:26 
GeneralRe: How to make Column of DataTable Visible False Pin
varshavmane7-Feb-07 19:30
varshavmane7-Feb-07 19:30 
GeneralRe: How to make Column of DataTable Visible False Pin
_AK_7-Feb-07 19:36
_AK_7-Feb-07 19:36 
GeneralRe: How to make Column of DataTable Visible False Pin
varshavmane7-Feb-07 19:41
varshavmane7-Feb-07 19:41 
GeneralRe: How to make Column of DataTable Visible False Pin
_AK_7-Feb-07 20:03
_AK_7-Feb-07 20:03 
GeneralRe: How to make Column of DataTable Visible False Pin
varshavmane7-Feb-07 20:22
varshavmane7-Feb-07 20:22 
I got some code on google but it showing some error:

Dim mt As DataTable
' Define datatable
Dim col As DataColumn
' Define columns
newGrid.DataSource = mt
' define datasource for datagrid
For Each col In mt.Columns
' go through all the columns
Dim dg As New BoundColumn()
' create a new bound column
dg.DataField = col.ColumnName
' define the column name in datagrid
newGrid.Columns.Add(dg)
' add the column to datagrid
If col.ColumnName = "ID" Then
' if the field is a unique id
newGrid.Columns(col.Ordinal).Visible = False '
set visible = false
End If
Next
newGrid.DataBind()

it giving error on newGrid.Columns.Add(dg) line.It says cannot control to System.Web.UI.WebControls.BoundColumn to System.Web.UI.WebControls.DataControlField.

Trying to analysis the code.
If u can help me for the same.
GeneralRe: Thanks for the help Pin
varshavmane7-Feb-07 23:20
varshavmane7-Feb-07 23:20 
QuestionExporting datagrid to CSV..How to display the headers in bold? Pin
Vsree7-Feb-07 18:40
Vsree7-Feb-07 18:40 
Questionbutton inside a gridview Pin
sarodam7-Feb-07 18:04
sarodam7-Feb-07 18:04 
AnswerRe: button inside a gridview Pin
_AK_7-Feb-07 18:49
_AK_7-Feb-07 18:49 
AnswerRe: button inside a gridview Pin
gauthee8-Feb-07 0:39
gauthee8-Feb-07 0:39 
QuestionInsert statement Conflict in the GridView Pin
BORN...again!7-Feb-07 17:13
BORN...again!7-Feb-07 17:13 
AnswerRe: Insert statement Conflict in the GridView Pin
_AK_7-Feb-07 17:28
_AK_7-Feb-07 17:28 
GeneralRe: Insert statement Conflict in the GridView Pin
BORN...again!7-Feb-07 18:01
BORN...again!7-Feb-07 18:01 
GeneralRe: Insert statement Conflict in the GridView Pin
_AK_7-Feb-07 18:42
_AK_7-Feb-07 18:42 
QuestionFind a Drp system sourcecode! Pin
tangmin20087-Feb-07 16:22
tangmin20087-Feb-07 16:22 
AnswerRe: Find a Drp system sourcecode! Pin
_AK_7-Feb-07 17:29
_AK_7-Feb-07 17:29 
QuestionHow to show a default photo. Pin
www.Developerof.NET7-Feb-07 15:11
www.Developerof.NET7-Feb-07 15:11 
AnswerRe: How to show a default photo. Pin
_AK_7-Feb-07 17:18
_AK_7-Feb-07 17:18 
AnswerRe: How to show a default photo. Pin
dinus287-Feb-07 17:34
dinus287-Feb-07 17:34 
GeneralRe: How to show a default photo. Pin
www.Developerof.NET7-Feb-07 19:18
www.Developerof.NET7-Feb-07 19:18 
GeneralRe: How to show a default photo. Pin
_AK_7-Feb-07 19:29
_AK_7-Feb-07 19:29 
GeneralRe: How to show a default photo. Pin
www.Developerof.NET7-Feb-07 21:15
www.Developerof.NET7-Feb-07 21:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.