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. Gridview display and using Session Problem

Gridview display and using Session Problem

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

    I have used Gridview to that will show a data from the Database, but in the configuration I specify that the WHERE Clause must be SQL Expression Value [Username] = @Username Session("Username") Who can I put the Session value inside this statement (I want to use it hard coded, but I don't know what to write in the page.aspx.cs file? Thanks a lot for your cooperation. Best regards,

    B A 2 Replies Last reply
    0
    • K ksaw123

      I have used Gridview to that will show a data from the Database, but in the configuration I specify that the WHERE Clause must be SQL Expression Value [Username] = @Username Session("Username") Who can I put the Session value inside this statement (I want to use it hard coded, but I don't know what to write in the page.aspx.cs file? Thanks a lot for your cooperation. Best regards,

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Using Sessions[^]


      I Love T-SQL

      K 1 Reply Last reply
      0
      • B Blue_Boy

        Using Sessions[^]


        I Love T-SQL

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

        Where should I put it? Because I have define it(I used static on for testing) inside Page_Load(.....) { Session["Username"] = "lll"; } But it does not show the Gridview.

        B 1 Reply Last reply
        0
        • K ksaw123

          Where should I put it? Because I have define it(I used static on for testing) inside Page_Load(.....) { Session["Username"] = "lll"; } But it does not show the Gridview.

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          Put it before you bind GridView. Session["Username"]="lll"; . . . GridView1.DataBind();


          I Love T-SQL

          1 Reply Last reply
          0
          • K ksaw123

            I have used Gridview to that will show a data from the Database, but in the configuration I specify that the WHERE Clause must be SQL Expression Value [Username] = @Username Session("Username") Who can I put the Session value inside this statement (I want to use it hard coded, but I don't know what to write in the page.aspx.cs file? Thanks a lot for your cooperation. Best regards,

            A Offline
            A Offline
            AlexeiXX3
            wrote on last edited by
            #5

            If you want to hardcode the parameter in the query, dont use a session parameter, just switch to sourcemode in the form designer (Shift + F7) and find the sql query, and add the where clause Or why are you using a sessionparameter?

            Alexei Rodriguez

            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