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. GridView (A to Z)+Sourabh

GridView (A to Z)+Sourabh

Scheduled Pinned Locked Moved ASP.NET
graphicsdesignquestion
2 Posts 2 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.
  • D Offline
    D Offline
    Dot Net Jantu
    wrote on last edited by
    #1

    I have created a gridView at run time like this: Dim dgUserGrid As GridView dgUserGrid = New GridView dgUserGrid.ID = 5 dgUserGrid.AutoGenerateColumns = False dgUserGrid.BackColor = Drawing.Color.Brown dgUserGrid.ForeColor = Drawing.Color.White dgUserGrid.AllowSorting = True dgUserGrid.AlternatingRowStyle.BackColor = Drawing.Color.BurlyWood also added this: Protected WithEvents dgUserGrid As System.Web.UI.WebControls.GridView dssave.Tables("dtUsers").Rows.Add() dssave.Tables("dtUsers").Rows(0)("UserName") = name.Text.Trim dssave.Tables("dtUsers").Rows(0)("cPassword") = password.Text.Trim dssave.Tables("dtUsers").Rows(0)("Role") = Role.SelectedItem.Text.Trim dssave.Tables("dtUsers").Rows(0)("PasswordChanged") = 0 Dim userdetgrid As GridView = GridHolder.FindControl(5) userdetgrid.DataSource = dssave.Tables("dtUsers") userdetgrid.DataBind() this code is working fine but not appropriate. I want to create boundcolumns at runtime.??????

    Thanks and Regards,

    S 1 Reply Last reply
    0
    • D Dot Net Jantu

      I have created a gridView at run time like this: Dim dgUserGrid As GridView dgUserGrid = New GridView dgUserGrid.ID = 5 dgUserGrid.AutoGenerateColumns = False dgUserGrid.BackColor = Drawing.Color.Brown dgUserGrid.ForeColor = Drawing.Color.White dgUserGrid.AllowSorting = True dgUserGrid.AlternatingRowStyle.BackColor = Drawing.Color.BurlyWood also added this: Protected WithEvents dgUserGrid As System.Web.UI.WebControls.GridView dssave.Tables("dtUsers").Rows.Add() dssave.Tables("dtUsers").Rows(0)("UserName") = name.Text.Trim dssave.Tables("dtUsers").Rows(0)("cPassword") = password.Text.Trim dssave.Tables("dtUsers").Rows(0)("Role") = Role.SelectedItem.Text.Trim dssave.Tables("dtUsers").Rows(0)("PasswordChanged") = 0 Dim userdetgrid As GridView = GridHolder.FindControl(5) userdetgrid.DataSource = dssave.Tables("dtUsers") userdetgrid.DataBind() this code is working fine but not appropriate. I want to create boundcolumns at runtime.??????

      Thanks and Regards,

      S Offline
      S Offline
      Sarani Ravindran
      wrote on last edited by
      #2

      Dim grid As New GridView Dim b1 As New BoundField b1.HeaderText = "SerialNo" b1.DataField = "SerialNo" grid.Columns.Add(b1) grid.Columns.Add(b2) God is always with you.

      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