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. Display the Page.User.Identity.Name in the datagrid hyperlink column

Display the Page.User.Identity.Name in the datagrid hyperlink column

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netdatabasesql-server
5 Posts 3 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.
  • J Offline
    J Offline
    JoJuPi01
    wrote on last edited by
    #1

    Hi, I am using asp.net, C# and sql server I have a gridview control which looks like the following In the DataNavigateUrlFormatString="http://www.anrdoezrs.net/click-1850716-10387413?sid={0} i want to replace the {0} with the logged in user's identity which is Page.User.Identity.Name. How should i do it should i do it in the DataNavigateUrlFields property or in the code behind pages. I tried creating a method in the code behind file as follows to get the identity and displaying it public string GetMemberID() { return Page.User.Identity.Name.ToString(); } and tried calling it in the datagrid hyperlink column as follows but got an error message as follows : Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.HyperLinkField does not have a DataBinding event. How should i go about it. Please help. Thanx in advance.

    I 1 Reply Last reply
    0
    • J JoJuPi01

      Hi, I am using asp.net, C# and sql server I have a gridview control which looks like the following In the DataNavigateUrlFormatString="http://www.anrdoezrs.net/click-1850716-10387413?sid={0} i want to replace the {0} with the logged in user's identity which is Page.User.Identity.Name. How should i do it should i do it in the DataNavigateUrlFields property or in the code behind pages. I tried creating a method in the code behind file as follows to get the identity and displaying it public string GetMemberID() { return Page.User.Identity.Name.ToString(); } and tried calling it in the datagrid hyperlink column as follows but got an error message as follows : Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.HyperLinkField does not have a DataBinding event. How should i go about it. Please help. Thanx in advance.

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      put the hyperlink inside an ItemTemplate and using <%#DataBinder.Eval( Container, "MyLoginName")%> I'm not an expert yet, but I play one at work. Yeah and here too. -- modified at 14:12 Thursday 8th December, 2005

      K J 2 Replies Last reply
      0
      • I Ista

        put the hyperlink inside an ItemTemplate and using <%#DataBinder.Eval( Container, "MyLoginName")%> I'm not an expert yet, but I play one at work. Yeah and here too. -- modified at 14:12 Thursday 8th December, 2005

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

        I agree is the way to go Kind Regards Ian Claxton

        1 Reply Last reply
        0
        • I Ista

          put the hyperlink inside an ItemTemplate and using <%#DataBinder.Eval( Container, "MyLoginName")%> I'm not an expert yet, but I play one at work. Yeah and here too. -- modified at 14:12 Thursday 8th December, 2005

          J Offline
          J Offline
          JoJuPi01
          wrote on last edited by
          #4

          Hi Ista, Thanx for the reply. I tried to put the hyperlink inside an item template and the script looks as follows : Here the "Text" is the name of the member i want to get displayed and NavigateUrl is the url i want to go when that particular member name is clicked. Now my problem is i want to populate the navigateurl from a database so the url is different for each member and the url is in this format : http://www.memberurl.com/sid={0} where i want {0} to be replaced by the logged users GUID for which i use Page.User.Identity.Name How should i go about it???? -- modified at 16:25 Thursday 8th December, 2005

          I 1 Reply Last reply
          0
          • J JoJuPi01

            Hi Ista, Thanx for the reply. I tried to put the hyperlink inside an item template and the script looks as follows : Here the "Text" is the name of the member i want to get displayed and NavigateUrl is the url i want to go when that particular member name is clicked. Now my problem is i want to populate the navigateurl from a database so the url is different for each member and the url is in this format : http://www.memberurl.com/sid={0} where i want {0} to be replaced by the logged users GUID for which i use Page.User.Identity.Name How should i go about it???? -- modified at 16:25 Thursday 8th December, 2005

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #5

            Using the text you mention create a hyperlink command button. Apply the Datasource properties and point it to the member id. You should be fine after that I'm not an expert yet, but I play one at work. Yeah and here too. -- modified at 8:57 Friday 9th December, 2005 a <HyperlinkCommandButton> I mean

            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