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. template column in GridView !!??

template column in GridView !!??

Scheduled Pinned Locked Moved ASP.NET
visual-studiodockerquestion
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.
  • N Offline
    N Offline
    Naif_Prof
    wrote on last edited by
    #1

    Dears Hi, Im using VS 2005 and Instead of using SELECT in GridView I need to use on of GridView column as link to anther page and pass values to second page I use template column but how I can pass parameter and specify the link I use the following but is not working href ="~/xyz/page2.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID") %>"> thanks....

    D 1 Reply Last reply
    0
    • N Naif_Prof

      Dears Hi, Im using VS 2005 and Instead of using SELECT in GridView I need to use on of GridView column as link to anther page and pass values to second page I use template column but how I can pass parameter and specify the link I use the following but is not working href ="~/xyz/page2.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID") %>"> thanks....

      D Offline
      D Offline
      drsujo
      wrote on last edited by
      #2

      You can put Label in Template column. In event RowDataBound of GridView put this code : protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lbl = (Label)e.Row.Cells[TemplateCellNumber].Controls[1]; lbl.Attributes.Add("onclick", string.Format( "window.location = 'url?{0}={1}'",param1, param2)); lbl.Style.Add("cursor", "pointer"); } }

      and they all died

      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