need some suggesions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dorandoran
    New Member
    • Feb 2007
    • 145

    #1

    need some suggesions

    PAY PERIOD NAVIGATION
    =============== ======
    I need to have 2 combo boxes (cboFrom and cboTo). these two boxes need to fill with fromdate and todate from a table "tblPayPeriods" .

    sample pic is attached.

    1. I would like default data to be this month and year.
    2. I would like put 2 buttons (btnPreviousPer iod and btnNextPeriod). When user clicks on this I would like repopulate the textboxes with respetive from and to date.

    I am kinda lost as to what approach I should take. and How will I do it?

    I found this article, is this too much coding. I need as little coding as possible because I am going to have lots of coding for this page.
    Build faster with enterprise-ready, AI-powered UI components including blazing fast grids, charts, schedulers, and editors. Get PDF, Word, and Excel document SDKs for Blazor, React, Angular, JavaScript, and .NET MAUI.
  • dorandoran
    New Member
    • Feb 2007
    • 145

    #2
    I decided to have one drop down box and my store proc looks like below.
    select cast(convert(va rchar,MSG.fromd ate,101) + ' - ' + convert(varchar ,MSG.todate,101 ) as char(50)) PayPeriod
    from dbo.MESSAGES MSG
    where (year(fromdate) =@pYear)

    I can populate the drop down list with this store procedure. but I dont know how to add the logic to display current pay period (for example, every month we have 2 pay period, 1/1/2009 to 1/15/2009 and 1/16/2009 to 1/31/2009). the drop down list already contains all 2009 pay period (24 records). I like to display 4/16/2009 to 4/30/2009 by default cause thats the month we are in. hope it's making sense.

    I also need to program previous and next pay period button? Need some direction please..

    Comment

    • dorandoran
      New Member
      • Feb 2007
      • 145

      #3
      This works.
      protected void btnNextPeriod_C lick(object sender, EventArgs e)
      {
      int intCurrentItem = ddlPayPeriod.Se lectedIndex;
      ddlPayPeriod.Se lectedIndex = intCurrentItem + 1;

      }
      protected void btnPreviouPerio d_Click(object sender, EventArgs e)
      {
      int intCurrentItem = ddlPayPeriod.Se lectedIndex;
      ddlPayPeriod.Se lectedIndex = intCurrentItem - 1;

      }

      =============== =============== =============== =
      I would like to fill 2 labels when the selected index change. The fileds are fromdate and todate to lblfrom and lblto.

      Comment

      • dorandoran
        New Member
        • Feb 2007
        • 145

        #4
        This forum is SUPER slow. I wasnt asking for code snippet. Just wanted some suggesion. I finally got it work. Here is the working code.
        Code:
            protected void Page_Load(object sender, EventArgs e)
            {
                //btnPreviouPeriod.Text = "Previous" + "\r" + "Period  ";
                //btnNextPeriod.Text = " Next " + "\r" + "Period";
        
                 fillPeriod();       
                
            }
        
            void fillPeriod()
            {
                ddlPayPeriod.DataTextField = "payperiod" ;
                ddlPayPeriod.DataValueField = "payperiod";
                clsTimeCardReports tcr = new clsTimeCardReports();        
                ddlPayPeriod.DataSource = tcr.GetPayPeriods();
                ddlPayPeriod.DataBind();
                string fromValue = ddlPayPeriod.SelectedValue.ToString();
                lblDataFrom.Text = fromValue.Substring(0, 10);
                string toValue = ddlPayPeriod.SelectedValue.ToString();
                lblDataTo.Text = toValue.Substring(13 , 10);
            }
            protected void btnNextPeriod_Click(object sender, EventArgs e)
            {
                int intCurrentItem = ddlPayPeriod.SelectedIndex;
                ddlPayPeriod.SelectedIndex = intCurrentItem + 1;
                string fromValue = ddlPayPeriod.SelectedValue.ToString();
                lblDataFrom.Text = fromValue.Substring(0, 10);
                string toValue = ddlPayPeriod.SelectedValue.ToString();
                lblDataTo.Text = toValue.Substring(13, 10);
        
                
            }
            protected void btnPreviouPeriod_Click(object sender, EventArgs e)
            {
                int intCurrentItem = ddlPayPeriod.SelectedIndex;
                ddlPayPeriod.SelectedIndex = intCurrentItem - 1;
                string fromValue = ddlPayPeriod.SelectedValue.ToString();
                lblDataFrom.Text = fromValue.Substring(0, 10);
                string toValue = ddlPayPeriod.SelectedValue.ToString();
                lblDataTo.Text = toValue.Substring(13, 10);
        
                 
            }

        Comment

        Working...