Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. About Datagrid [modified]

About Datagrid [modified]

Scheduled Pinned Locked Moved ASP.NET
designtutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mahichandu
    wrote on last edited by
    #1

    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

    B A B 3 Replies Last reply
    0
    • M mahichandu

      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

      B Offline
      B Offline
      Bassam Saoud
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • M mahichandu

        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

        A Offline
        A Offline
        adatapost
        wrote on last edited by
        #3

        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)

        1 Reply Last reply
        0
        • M mahichandu

          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

          B Offline
          B Offline
          Baran M
          wrote on last edited by
          #4

          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.

          M 1 Reply Last reply
          0
          • B Baran M

            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.

            M Offline
            M Offline
            mahichandu
            wrote on last edited by
            #5

            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 0

            Could Anyone suggest me ..How to proceed further in detail with some code...:

            modified on Monday, June 1, 2009 1:04 PM

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups