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. How to select and hyperlink the contents of a row in a grid view dynamically

How to select and hyperlink the contents of a row in a grid view dynamically

Scheduled Pinned Locked Moved ASP.NET
questioncsssysadminhelptutorial
11 Posts 4 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.
  • K kidus1

    Hi How can I select and hyperlink the contents of a row in a gridview server control dynamically.I want the contents of the selected row to be transferred to the next page(using the hyerlink). ANy onwe who can help me? thanks kidus

    N Offline
    N Offline
    Not Active
    wrote on last edited by
    #2

    What do you mean, dynamically? At runtime on the client-side? Right some javascript to handle the mouseover event on the row. Server-side? Use a template.


    only two letters away from being an asset

    K 1 Reply Last reply
    0
    • N Not Active

      What do you mean, dynamically? At runtime on the client-side? Right some javascript to handle the mouseover event on the row. Server-side? Use a template.


      only two letters away from being an asset

      K Offline
      K Offline
      kidus1
      wrote on last edited by
      #3

      hi I mean at ruutime and on the server side.I wrote using mouseover on the client side but it doesn't hyperlink? Can y show me on both?server side and client side scripting? thanks kidus

      N 1 Reply Last reply
      0
      • K kidus1

        hi I mean at ruutime and on the server side.I wrote using mouseover on the client side but it doesn't hyperlink? Can y show me on both?server side and client side scripting? thanks kidus

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #4

        Server-side is easy, like I said you need to use a template. See the template columns section in this article. http://www.codeproject.com/aspnet/datagriddemo.asp[^] If you create a hyperlink using the above method there is no need to use client-side scripting.

        kidus1 wrote:

        I wrote using mouseover on the client side but it doesn't hyperlink?

        Explain what your tried. So some code.


        only two letters away from being an asset

        K 1 Reply Last reply
        0
        • N Not Active

          Server-side is easy, like I said you need to use a template. See the template columns section in this article. http://www.codeproject.com/aspnet/datagriddemo.asp[^] If you create a hyperlink using the above method there is no need to use client-side scripting.

          kidus1 wrote:

          I wrote using mouseover on the client side but it doesn't hyperlink?

          Explain what your tried. So some code.


          only two letters away from being an asset

          K Offline
          K Offline
          kidus12
          wrote on last edited by
          #5

          hi I created a clickable gridview control but I can't hyperlink to other page.I am trying to do this using Javascripts. Any help? thanks kidus

          N 1 Reply Last reply
          0
          • K kidus12

            hi I created a clickable gridview control but I can't hyperlink to other page.I am trying to do this using Javascripts. Any help? thanks kidus

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #6

            kidus12 wrote:

            Any help?

            Show the code you are using, then maybe we can help. I don't understand how are you creating this "clickable gridview" in javascript?


            only two letters away from being an asset

            K 1 Reply Last reply
            0
            • K kidus1

              Hi How can I select and hyperlink the contents of a row in a gridview server control dynamically.I want the contents of the selected row to be transferred to the next page(using the hyerlink). ANy onwe who can help me? thanks kidus

              C Offline
              C Offline
              chand10
              wrote on last edited by
              #7

              Hi You can Create a HyperLinkField column(s) for GridView.

              Cheers Chandu

              1 Reply Last reply
              0
              • N Not Active

                kidus12 wrote:

                Any help?

                Show the code you are using, then maybe we can help. I don't understand how are you creating this "clickable gridview" in javascript?


                only two letters away from being an asset

                K Offline
                K Offline
                kidus1
                wrote on last edited by
                #8

                hi here is the code for creating the clickable Row using Javascript if (e.Row.DataItemIndex == -1) return; e.Row.Attributes.Add("onMouseOver", "this.style.cursor='hand';"); e.Row.Attributes["onmouseover"] = "javascript:setMouseOverColor(this);"; e.Row.Attributes["onmouseout"] = "javascript:setMouseOutColor(this);"; e.Row.Attributes.Add("onclick", this.GetPostBackClientEvent(GrdDynamic, "Select$" + e.Row.RowIndex.ToString())); and what I want to do is to hyperlink to other page when the row in the clickable gridview is clicked and passed the contents of the clicked row to the other page(using session). thanks kidus

                N 1 Reply Last reply
                0
                • K kidus1

                  hi here is the code for creating the clickable Row using Javascript if (e.Row.DataItemIndex == -1) return; e.Row.Attributes.Add("onMouseOver", "this.style.cursor='hand';"); e.Row.Attributes["onmouseover"] = "javascript:setMouseOverColor(this);"; e.Row.Attributes["onmouseout"] = "javascript:setMouseOutColor(this);"; e.Row.Attributes.Add("onclick", this.GetPostBackClientEvent(GrdDynamic, "Select$" + e.Row.RowIndex.ToString())); and what I want to do is to hyperlink to other page when the row in the clickable gridview is clicked and passed the contents of the clicked row to the other page(using session). thanks kidus

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #9

                  You are trying to make it more difficult than it is. Use a template column or Hyperlink column to create the link, pass the id of the row to the next page and retrieve the row data from the datasource on that page.


                  only two letters away from being an asset

                  K 1 Reply Last reply
                  0
                  • N Not Active

                    You are trying to make it more difficult than it is. Use a template column or Hyperlink column to create the link, pass the id of the row to the next page and retrieve the row data from the datasource on that page.


                    only two letters away from being an asset

                    K Offline
                    K Offline
                    kidus1
                    wrote on last edited by
                    #10

                    hi pls ..... some small example thanks kidus

                    N 1 Reply Last reply
                    0
                    • K kidus1

                      hi pls ..... some small example thanks kidus

                      N Offline
                      N Offline
                      Not Active
                      wrote on last edited by
                      #11

                      I already have. Figure it out. It isn't that difficult.:rolleyes:


                      only two letters away from being an asset

                      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