About Datagrid [modified]
-
Hi.. Below is my databse table.. I can populate this data into the UI Page.. My task is to automatically delete the columns which has '0'(zero) value...and i have to delete the first row of my table... Hear i am not going to use any itemtemplate column.. I have to write some code in codebehind.. JurisdictionID JurisdictionDescription Year1 Year2 Year3 Year4 Year5 Year6 Year7 2005 2006 2009 0 0 0 0 AL Alabama 0 0 6 0 0 0 0 AK Alaska 2 0 0 0 0 0 0 Could Anyone suggest me ..How to proceed further in detail with some code...
modified on Monday, June 1, 2009 12:14 PM
-
Hi.. Below is my databse table.. I can populate this data into the UI Page.. My task is to automatically delete the columns which has '0'(zero) value...and i have to delete the first row of my table... Hear i am not going to use any itemtemplate column.. I have to write some code in codebehind.. JurisdictionID JurisdictionDescription Year1 Year2 Year3 Year4 Year5 Year6 Year7 2005 2006 2009 0 0 0 0 AL Alabama 0 0 6 0 0 0 0 AK Alaska 2 0 0 0 0 0 0 Could Anyone suggest me ..How to proceed further in detail with some code...
modified on Monday, June 1, 2009 12:14 PM
If you are just displaying data in the UI , I would recommend a repeater. it is much lighter. As for deleting 0 values simply add a constraint to your where clause in the proc where you are retrieving data.
-
Hi.. Below is my databse table.. I can populate this data into the UI Page.. My task is to automatically delete the columns which has '0'(zero) value...and i have to delete the first row of my table... Hear i am not going to use any itemtemplate column.. I have to write some code in codebehind.. JurisdictionID JurisdictionDescription Year1 Year2 Year3 Year4 Year5 Year6 Year7 2005 2006 2009 0 0 0 0 AL Alabama 0 0 6 0 0 0 0 AK Alaska 2 0 0 0 0 0 0 Could Anyone suggest me ..How to proceed further in detail with some code...
modified on Monday, June 1, 2009 12:14 PM
Here is a code might help you. I think you are using MSSQL server 2005. SqlConnection cnnew SqlConnection(...your_connection_string....); SqlCommand cmd=new SqlCommand(); cmd.Connection=cn; cmd.CommandText="your_proc"; cmd.CommandType=CommandType.StoredProcedure; ... ... SqlDataAdapter adp=new SqlDataAdapter(cmd); DataTable dt=new DataTable(); adp.Fill(dt); GridView v=new GridView(); v.DataSource=dt; v.DataBind(); form1.Controls.Add(v); .. ..
A DATAPOST COMPUTER CENTRE (K.V Prajapati)
-
Hi.. Below is my databse table.. I can populate this data into the UI Page.. My task is to automatically delete the columns which has '0'(zero) value...and i have to delete the first row of my table... Hear i am not going to use any itemtemplate column.. I have to write some code in codebehind.. JurisdictionID JurisdictionDescription Year1 Year2 Year3 Year4 Year5 Year6 Year7 2005 2006 2009 0 0 0 0 AL Alabama 0 0 6 0 0 0 0 AK Alaska 2 0 0 0 0 0 0 Could Anyone suggest me ..How to proceed further in detail with some code...
modified on Monday, June 1, 2009 12:14 PM
logic 1: When you fetch the values from the table, write query like this select case empty_column when 0 then '' from table_name where logic 2: If you use gridview, in GridView1_RowDataBound event you can check like this, if (e.Row.Cells[1].Text.Equals("0")) { e.Row.Cells[1].Text = ""; } Hope it helps you.
-
logic 1: When you fetch the values from the table, write query like this select case empty_column when 0 then '' from table_name where logic 2: If you use gridview, in GridView1_RowDataBound event you can check like this, if (e.Row.Cells[1].Text.Equals("0")) { e.Row.Cells[1].Text = ""; } Hope it helps you.
hey thnx for your reply..actually my task is described below in detail.. Below is my databse table.. I can populate this data into the UI Page.. My task is to automatically delete the columns which has '0'(zero) value...and i have to delete the first row of my table... Hear i am not going to use any itemtemplate column.. I have to write some code in codebehind..
JurisdictionID JurisdictionDescription Year1 Year2 Year3 Year4 Year5 Year6 Year7
2005 2006 2009 0 0 0 0
AL Alabama 0 0 6 0 0 0 0
AK Alaska 2 0 0 0 0 0 0Could Anyone suggest me ..How to proceed further in detail with some code...:
modified on Monday, June 1, 2009 1:04 PM