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. Get Value of Cell in ItemTemplate for Datagrid

Get Value of Cell in ItemTemplate for Datagrid

Scheduled Pinned Locked Moved ASP.NET
graphicsdesign
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.
  • T Offline
    T Offline
    thedom2
    wrote on last edited by
    #1

    I want to make a row red based on value of cell for a datagrid. Now I have code that works for bound columns but if its a ItemTemplate its no good. Here is code that works for bound Columns Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim sStr As String sStr = Convert.ToString(System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Status")) If sStr = "DEAD" Then e.Row.BackColor = System.Drawing.Color.Red End If End Sub Can someone please assist me and supply code for checking data on a itemtemplate please. thanks coders

    M 1 Reply Last reply
    0
    • T thedom2

      I want to make a row red based on value of cell for a datagrid. Now I have code that works for bound columns but if its a ItemTemplate its no good. Here is code that works for bound Columns Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim sStr As String sStr = Convert.ToString(System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Status")) If sStr = "DEAD" Then e.Row.BackColor = System.Drawing.Color.Red End If End Sub Can someone please assist me and supply code for checking data on a itemtemplate please. thanks coders

      M Offline
      M Offline
      Mubashir Javaid
      wrote on last edited by
      #2

      First set a command name and commandArgument to some cell text like this then write this code behind protected void grdVDataQueries_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Open")) { string args = e.CommandArgument.ToString(); } }

      God Bless you. Always do good to others

      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