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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. how to check the grid value and database value [modified]

how to check the grid value and database value [modified]

Scheduled Pinned Locked Moved IT & Infrastructure
cssdatabasegraphicssysadminhelp
2 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
    priyamsc
    wrote on last edited by
    #1

    hi, this is my coding .. i need to hightlight particular row so i have given this coding its working now..but i have written in datagrid load event.so its working ly when the grid load..but when i do some actions on the grid tat wont be highlighted so pls help me how to refresh.... protected void DataGrid2_Load(object sender, EventArgs e) { SqlConnection con2 = new SqlConnection("server=SOFTWARE4;uid=sa;pwd=;database=helpdesk1"); con2.Open(); string t = "select callno from swiftresult where status='e'"; SqlCommand cmd2 = new SqlCommand(t, con2); SqlDataReader dr1; dr1 = cmd2.ExecuteReader(); if (dr1.Read()) { int callno=Convert .ToInt32(dr1["callno"]); Response.Write(callno); foreach (DataGridItem dg in DataGrid2.Items) { string k = Convert.ToString(dg.Cells[0].Text.ToString()); if (callno==Int32.Parse(k)) { Response.Write(""+k+""); dg.BackColor = System.Drawing.Color.Tomato; } }

    k.priya

    modified on Saturday, March 15, 2008 3:11 AM


    P 1 Reply Last reply
    0
    • P priyamsc

      hi, this is my coding .. i need to hightlight particular row so i have given this coding its working now..but i have written in datagrid load event.so its working ly when the grid load..but when i do some actions on the grid tat wont be highlighted so pls help me how to refresh.... protected void DataGrid2_Load(object sender, EventArgs e) { SqlConnection con2 = new SqlConnection("server=SOFTWARE4;uid=sa;pwd=;database=helpdesk1"); con2.Open(); string t = "select callno from swiftresult where status='e'"; SqlCommand cmd2 = new SqlCommand(t, con2); SqlDataReader dr1; dr1 = cmd2.ExecuteReader(); if (dr1.Read()) { int callno=Convert .ToInt32(dr1["callno"]); Response.Write(callno); foreach (DataGridItem dg in DataGrid2.Items) { string k = Convert.ToString(dg.Cells[0].Text.ToString()); if (callno==Int32.Parse(k)) { Response.Write(""+k+""); dg.BackColor = System.Drawing.Color.Tomato; } }

      k.priya

      modified on Saturday, March 15, 2008 3:11 AM


      P Offline
      P Offline
      priyamsc
      wrote on last edited by
      #2

      i found the answer...i used link button when i click it s not working..so i have given ondatabinding="DataGrid2_Load()".this property in link button in html codings thats al..

      k.priya

      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