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. Master page?

Master page?

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
10 Posts 7 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
    Karthick_gc
    wrote on last edited by
    #1

    Hi friends , I have to add some features in my project. If a user logs in, their log in name will be appear in the master page so that it can be viewed throughout the project. How to do it? Can anyone will guide?

    C S R 3 Replies Last reply
    0
    • K Karthick_gc

      Hi friends , I have to add some features in my project. If a user logs in, their log in name will be appear in the master page so that it can be viewed throughout the project. How to do it? Can anyone will guide?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Buy an ASP.NET book and read it. Make sure you read the chapter on the session object.

      Christian Graus Driven to the arms of OSX by Vista.

      K 1 Reply Last reply
      0
      • K Karthick_gc

        Hi friends , I have to add some features in my project. If a user logs in, their log in name will be appear in the master page so that it can be viewed throughout the project. How to do it? Can anyone will guide?

        S Offline
        S Offline
        Subin Alex
        wrote on last edited by
        #3

        Hi, Inorder to display the login name of the user: 1.First, add a master page and include all the child pages for it. 2.Put the control u wish to display in every page outside content page(if u put the control in it, u cud c tat only in the master page) 3. Aftr a user logs in , the username shud b got into a Session variable (eg: Session["uname"]= username ) and this session var.'s value is assigned to the control(eg:label) Bingo ! there goes the question. Good Luck!!

        1 Reply Last reply
        0
        • C Christian Graus

          Buy an ASP.NET book and read it. Make sure you read the chapter on the session object.

          Christian Graus Driven to the arms of OSX by Vista.

          K Offline
          K Offline
          Karthick_gc
          wrote on last edited by
          #4

          I store the user name in a session variable. My question is how to display it in the Master page when Login button is clicked?

          N 1 Reply Last reply
          0
          • K Karthick_gc

            Hi friends , I have to add some features in my project. If a user logs in, their log in name will be appear in the master page so that it can be viewed throughout the project. How to do it? Can anyone will guide?

            R Offline
            R Offline
            rajmca g
            wrote on last edited by
            #5

            to display user name in master page. just put one lable in master page and in master page Page_load event. just assign the session to lable ex: lblusername.text=Session["username"];

            K 1 Reply Last reply
            0
            • R rajmca g

              to display user name in master page. just put one lable in master page and in master page Page_load event. just assign the session to lable ex: lblusername.text=Session["username"];

              K Offline
              K Offline
              Karthick_gc
              wrote on last edited by
              #6

              I did it as u told Like user.text = Session["pho"].ToString(); But during runtime it assign the master page variable first and give a error called Use the new keyword to create an object instance. can u correct it?

              R A 0 3 Replies Last reply
              0
              • K Karthick_gc

                I did it as u told Like user.text = Session["pho"].ToString(); But during runtime it assign the master page variable first and give a error called Use the new keyword to create an object instance. can u correct it?

                R Offline
                R Offline
                rajmca g
                wrote on last edited by
                #7

                Actually in Vb.net this is the solution for that, but i don't know in c# .net If Not Page.IsPostBack Then If Not Session("username") Is Nothing Then lituser.Text = Session("username") End if End if

                1 Reply Last reply
                0
                • K Karthick_gc

                  I store the user name in a session variable. My question is how to display it in the Master page when Login button is clicked?

                  N Offline
                  N Offline
                  N a v a n e e t h
                  wrote on last edited by
                  #8

                  Karthick_gc wrote:

                  My question is how to display it in the Master page when Login button is clicked?

                  As CG said, please get a good book and work with the examples.

                  Navaneeth How to use google | Ask smart questions

                  1 Reply Last reply
                  0
                  • K Karthick_gc

                    I did it as u told Like user.text = Session["pho"].ToString(); But during runtime it assign the master page variable first and give a error called Use the new keyword to create an object instance. can u correct it?

                    A Offline
                    A Offline
                    Abhijit Jana
                    wrote on last edited by
                    #9

                    I am again suggesting you please buy a Basic ASP.Net Book Or Please read some Article on Session.

                    cheers, Abhijit CodeProject MVP

                    1 Reply Last reply
                    0
                    • K Karthick_gc

                      I did it as u told Like user.text = Session["pho"].ToString(); But during runtime it assign the master page variable first and give a error called Use the new keyword to create an object instance. can u correct it?

                      0 Offline
                      0 Offline
                      0x3c0
                      wrote on last edited by
                      #10

                      Session["pho"] is equal to null. You may not have set it. Just put a null check in there:

                      if(Session["pho"] != null)
                      {
                      user.Text = Session["pho"].ToString();
                      }

                      Either way, this shows a lack of knowledge. Try to read as much as you can on ASP.Net. Look into coding Windows applications first; that will set the ground work for a basic grasp of C#, and the basic rules of the .Net Framework

                      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