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. date formatting in data grid.

date formatting in data grid.

Scheduled Pinned Locked Moved ASP.NET
helpcss
1 Posts 1 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.
  • P Offline
    P Offline
    perms
    wrote on last edited by
    #1

    Below is the code. I want to format the date column of data grid like "13,January 1900". i know DataFromatString = "{0:d}" for bound column. I am creating column dynamically. could anyone help to solve this issue. private DataView CreateDataSourceSourceWise() { string strSQL; string connstring = HttpContext.Current.Application["connstring"].ToString(); SqlConnection readConnection = new SqlConnection(connstring); SqlDataReader dbReader = null; int nUID = Convert.ToInt32(Session["UID"]); string CaName = Request.QueryString["CategoryName"]; strSQL= "select Description,CategoryName,GroupName,GroupImage,CreatedDate from group where ((UserID= '" + nUID + "') and ( CategoryName = '" + CaName + "' ))"; SqlCommand readCommand = new SqlCommand(strSQL,readConnection); readCommand.Connection.Open(); dbReader = readCommand.ExecuteReader(); DataTable dt = new DataTable(); DataRow dr; DataView dv; if (dbReader != null) { dt.Columns.Add(new DataColumn(Request.QueryString["CategoryName"])); dt.Columns.Add(new DataColumn("Join" , typeof(string))); dt.Columns.Add(new DataColumn("Members" , typeof(string))); dt.Columns.Add(new DataColumn ("DateCreated")); while (dbReader.Read()) { dr = dt.NewRow(); StringBuilder strTop = new StringBuilder(""); strTop.Append(ShowImageNew(dbReader)); strTop.Append("
    "); strTop.Append(""); strTop.Append("

    "); strTop.Append(Convert.ToString(dbReader["GroupName"])); strTop.Append("
    "); strTop.Append("    "); strTop.Append(Convert.ToString(dbReader["Description"])); strTop.Append("

    "); dr[0] = strTop.ToString(); dr[1] = "

    Join

    "; dr[2] ="

    " + dbReader["CategoryName"].ToString() +"

    "; string strlink =" []( + Convert.ToString(dbReader[)"; dr[3] ="

    " + dbReader["CreatedDate"] +"

    "; dt.Rows.Add(dr); } } else { Response.Write(("No Groups were created for this Category") + Request.QueryString["CategoryName"]);

    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