column hiding in Gridview
-
Hi ... I am using one asp.net 2 Gridview control. I am binding it with a datatable. Now I want to hide two columns in the Gridview. How to do that ..Plz help me This is my code... DataTable dt = new DataTable("STEPS"); DataColumn dcOrder = new DataColumn("Order", typeof(Int32)); DataColumn dcName = new DataColumn("Name", typeof(string)); //Datacolumns are added to table dtsteps. dt.Columns.AddRange(new DataColumn[] {dcOrder, dcName); ..... //Assigning dtsteps as the datasource of my gridview dgsteps MyGridView.DataSource = dt; MyGridView.DataBind(); Thanks in advance....
Ranjith
-
Hi ... I am using one asp.net 2 Gridview control. I am binding it with a datatable. Now I want to hide two columns in the Gridview. How to do that ..Plz help me This is my code... DataTable dt = new DataTable("STEPS"); DataColumn dcOrder = new DataColumn("Order", typeof(Int32)); DataColumn dcName = new DataColumn("Name", typeof(string)); //Datacolumns are added to table dtsteps. dt.Columns.AddRange(new DataColumn[] {dcOrder, dcName); ..... //Assigning dtsteps as the datasource of my gridview dgsteps MyGridView.DataSource = dt; MyGridView.DataBind(); Thanks in advance....
Ranjith
-
Hi ... I am using one asp.net 2 Gridview control. I am binding it with a datatable. Now I want to hide two columns in the Gridview. How to do that ..Plz help me This is my code... DataTable dt = new DataTable("STEPS"); DataColumn dcOrder = new DataColumn("Order", typeof(Int32)); DataColumn dcName = new DataColumn("Name", typeof(string)); //Datacolumns are added to table dtsteps. dt.Columns.AddRange(new DataColumn[] {dcOrder, dcName); ..... //Assigning dtsteps as the datasource of my gridview dgsteps MyGridView.DataSource = dt; MyGridView.DataBind(); Thanks in advance....
Ranjith
-
just do the following: datagrdview.Columns[0].Width = 0; this will hide the 0th column of the datagridview.
Thanks & Regards, Pramod "Everyone is a genius at least once a year"
There is no property "Width" for datagridview.columns. There i found a visible property but it doesnt work :(
Ranjith
-
There is no property "Width" for datagridview.columns. There i found a visible property but it doesnt work :(
Ranjith
-
This is the better method. dt.Columns["{COLUMN_NAME}"].ColumnMapping = MappingType.Hidden;
SINCERELY. ANTHONY ACUÑA PREFERED PHRASE: SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
I tried this way also.. But it is not working :(
Ranjith
-
this is what u have to do after setting the data to the datagrid. dataGridView1.Columns[0].Width = 0; This should be enough
Thanks & Regards, Pramod "Everyone is a genius at least once a year"
But I couldnt find any property Width for "dataGridView1.Columns[0]"
Ranjith