Display user name in the header when logged in

Last post 11-17-2009 10:08 PM by chetan.sarode. 89 replies.

Sort Posts:

  • Re: Display user name in the header when logged in

    11-05-2009, 11:06 PM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    For some reason this code of line:  

    Calendar1.SelectedDates.Add((DateTime)dr.GetOracleDateTime(0)); is displaying my dates from the database, but when I select it is not giving me the right date, I am getting the minvalue set(01/01/0001).

  • Re: Display user name in the header when logged in

    11-08-2009, 10:04 PM
    Locked

    If the values are binding properly first time and while selecting it is not gettimg that means the values are not eprsisited. Can you just confirm while selecting it is not binding again may be thats hw values not persisted 

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Display user name in the header when logged in

    11-09-2009, 5:13 PM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    I need to know how I can pass my calendar selected date from my default page to my redirect page.  Here's my code behind:

    Default page – Calendar   

    public partial class _Default : System.Web.UI.Page

    {

       

     

        protected void Page_Load(object sender, EventArgs e)

        {

           

     

            Label1.Text = "Welcome, " + Session["UserName"].ToString();

     

            if (!IsPostBack)

            {

                if (Session["UserName"].ToString() != null)

                {

                    string SessionName = Session["UserName"].ToString();

                  

                }

     

     

            }

     

        }

     

         

        protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)

        {

            FormsAuthentication.SignOut();

            Response.Redirect("Login.aspx");

        }

     

        protected void Calender1_DayRender(object source, DayRenderEventArgs e)

        {

           

           

            // Declare the query string.

     

            OracleConnection myConnection = new OracleConnection(ConfigurationManager.AppSettings["DSN"]);

            OracleCommand myCommand = new OracleCommand("SELECT to_date(a.PROJECT_DUE,'MM/DD/YYYY') FROM NEW_PROJECTS a WHERE upper(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "'or lower(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "' or upper(a.ASSIGNED_ID) = '" + Session["UserName"].ToString() + "'or lower(a.ASSIGNED_TO_ID) = '" + Session["UserName"].ToString() + "'and a.proj_status = 'Active'", myConnection);

            OracleDataReader dr;

     

     

            myConnection.Open();

            dr = myCommand.ExecuteReader();

          

         

            while (dr.Read())

           {

               //assign the calendar control dates already contained in the database

              

            Calendar1.SelectedDates.Add((DateTime)dr.GetOracleDateTime(0));

            e.Cell.Text = "<a href='edit_project.aspx?PROJECT_DUE=" + e.Day.Date.ToString("MM/dd/yyyy") + "'>" + e.Day.DayNumberText + "</a>";

       

           }

          

           dr.Close();

           myConnection.Close();

          

       }

     

       protected void Calendar1_SelectionChanged(object sender, EventArgs e)

        {

     

            OracleConnection myConnection = new OracleConnection(ConfigurationManager.AppSettings["DSN"]);

            OracleCommand myCommand = new OracleCommand("SELECT PROJECT_NAME, PROJECT_DUE, REQUESTED_MANAGER, PROJ_DESCRIPTION, PROJ_CATEGORY, PROJ_STATUS, ASSIGNED_TO, PRIORITY_LEVEL FROM NEW_PROJECTS  WHERE PROJECT_DUE = '" + Calendar1.SelectedDate.ToString("MM/dd/yyyy") + "'", myConnection);

            OracleDataReader dr;

     

     

                myConnection.Open();

                dr = myCommand.ExecuteReader();

          

         

               while (dr.Read())

                {

       

                   

                    Response.Write(dr.GetString(0));

                    Response.Write(dr.GetString(1));

                    Response.Write(dr.GetString(2));

                    Response.Write(dr.GetString(3));

                    Response.Write(dr.GetString(4));

                    Response.Write(dr.GetString(5));

                    Response.Write(dr.GetString(6));

                    Response.Write(dr.GetString(7));

                }

             

        }

     

          

    }

     

     

           

     Redirect page

    public partial class _Default : System.Web.UI.Page

    {

     

        protected void Page_Load(object sender, EventArgs e)

        {

     

          

            if (!Page.IsPostBack)

            {

               

                               

     

                LoadData();

     

            }

     

        }

     

     

           

     

        protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)

        {

            FormsAuthentication.SignOut();

            Response.Redirect("Login.aspx");

        }

     

        protected void btnShowCal_Click(object sender, EventArgs e)

        {

            Calendar1.Visible = true;

        }

        /************************************************************/

        protected void Calendar1_SelectionChanged(object sender, EventArgs e)

        {

            Project_Due.Text = Calendar1.SelectedDate.ToString("MM/dd/yyyy");

     

            Calendar1.Visible = false;

        }

     

     

     

        protected void LoadData()

        {

         

     

            //load data

          

            OracleConnection myConnection = new OracleConnection(ConfigurationManager.AppSettings["DSN"]);

            OracleCommand myCommand = new OracleCommand("SELECT PROJECT_NAME, PROJECT_DUE, REQUESTED_MANAGER, PROJ_DESCRIPTION, PROJ_CATEGORY, PROJ_STATUS, ASSIGNED_TO, PRIORITY_LEVEL FROM NEW_PROJECTS  WHERE PROJECT_DUE = '" + Calendar1.SelectedDate.ToString("MM/dd/yyyy")   + "'", myConnection);

            OracleDataReader dr;

     

     

            myConnection.Open();

            dr = myCommand.ExecuteReader();

           

           

            while (dr.Read())

            {

               

    Project_Name.Text = (string)dr["Project_Name"];

    Project_Due.Text = (string)dr["Project_Due"]; //this is the problem due date is not binding with the calendar selection date

                Requested_Manager.SelectedValue = (string)dr["Requested_Manager"];

                Proj_Description.Text = (string)dr["Proj_Description"];

                Proj_Category.SelectedValue = (string)dr["Proj_Category"];

                Proj_Status.SelectedValue = (string)dr["Proj_Status"];

                Assigned_To.SelectedValue = (string)dr["Assigned_To"];

                Priority_Level.SelectedValue =(string)dr["Priority_Level"];}

     

     

            myConnection.Close();

           

        }

     

        }

    }

        

     

            

     

              

     

          

                  

                 

       

     

          

      

     

     

  • Re: Display user name in the header when logged in

    11-09-2009, 10:07 PM
    Locked

    You have already done it

    e.Cell.Text = "<a href='edit_project.aspx?PROJECT_DUE=" + e.Day.Date.ToString("MM/dd/yyyy") + "'>" + e.Day.DayNumberText + "</a>";

    is there any  issue with above code

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Display user name in the header when logged in

    11-10-2009, 10:15 AM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    When I click my highlighted calendar date, it shows the date selected but when I redirect to the next page it is not populating the correct selected calendar date.  It is populating 01/01/0001. What am I doing wrong?  This is really weird. Somehow I need to pass the selected date to my next page, how to do that??? Please look through my code and let me know what I am missing. This might be clear to me.

  • Re: Display user name in the header when logged in

    11-10-2009, 10:11 PM
    Locked

    As I alreay told you, you can pass it in query string or Store it in Session so that you can access it on another page 

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Display user name in the header when logged in

    11-11-2009, 4:09 PM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    Please show me how to pass it in query string or Store it in Session from my calendarselectionchanged code.  That's the part I am confuse about. I dont' know where to begin. 

  • Re: Display user name in the header when logged in

    11-11-2009, 5:43 PM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    Hey Chetan-

    Please disregard this message. I've solved the problem..........YEEEEEY....WHEW! 

  • Re: Display user name in the header when logged in

    11-11-2009, 10:03 PM
    Locked

    Thats nice, you solved the problem. Cabn you just let me know how you solved I mean using QueryString or Session 

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Display user name in the header when logged in

    11-12-2009, 9:23 AM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    I've used QueryString. 

  • Re: Display user name in the header when logged in

    11-12-2009, 5:10 PM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    I got one more question: How do I display project names that's stored in database in my calendar.

    Here's my code-behind (CalendarDayRender):

     protected void Calender1_DayRender(object source, DayRenderEventArgs e)
        {
           
           
            // Declare the query string.

            OracleConnection myConnection = new OracleConnection(ConfigurationManager.AppSettings["DSN"]);
            OracleCommand myCommand = new OracleCommand("SELECT to_date(a.PROJECT_DUE,'MM/DD/YYYY'), PROJECT_NAME FROM NEW_PROJECTS a WHERE upper(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "'or lower(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "' or upper(a.ASSIGNED_TO_ID) = '" + Session["UserName"].ToString() + "'or lower(a.ASSIGNED_TO_ID) = '" + Session["UserName"].ToString() + "'and a.proj_status = 'Active'", myConnection);
            OracleDataReader dr;


            myConnection.Open();
            dr = myCommand.ExecuteReader();

            while (dr.Read())
            {
              
             
                //assign the calendar control dates already contained in the database
                string d1;
                d1 = e.Day.Date.ToString("MM/dd/yyyy");
                Calendar1.SelectedDates.Add((DateTime)dr.GetOracleDateTime(0));

              

                  
                e.Cell.Text = "<a href='edit_project.aspx?PROJECT_DUE=" + d1 + "'>" + e.Day.DayNumberText + "</a>";
             
            }

  • Re: Display user name in the header when logged in

    11-12-2009, 10:02 PM
    Locked

    What do you mean by this

    How do I display project names that's stored in database in my calendar.

    Do you want to show Project name in Calendar along with dates 

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Display user name in the header when logged in

    11-13-2009, 5:31 PM
    Locked
    • Member
      98 point Member
    • Cadeey
    • Member since 01-30-2008, 8:18 PM
    • Posts 53

    yes, that's what I mean.  I'm pulling the project name from the database. 

  • Re: Display user name in the header when logged in

    11-15-2009, 10:12 PM
    Locked

    I am not sure if we can show the project name in calendar. May br for that you need third party control 

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Display user name in the header when logged in

    11-17-2009, 10:08 PM
    Locked

    Any updates on this 

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
Page 6 of 6 (90 items) « First ... < Previous 2 3 4 5 6
Microsoft Communities