Getting month name

8 posts, 0 answers
  1. Brown
    Brown avatar
    48 posts
    Member since:
    Dec 2010

    Posted 11 Jan 2011 Link to this post

    Hi ,

     I need  small question about to get the month name ,,, If i click on the next " > "  button in the calendar i need to get the month name,,,  
     can you tell me how to do this?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2011 Link to this post

    Hello Brown,

    You can achieve this by attaching the client event OnCalendarViewChanged. Here is the sample code.

    JavaScript:
    function OnCalendarViewChanged(sender, args)
      {
          var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
          var monthNumber = sender.get_focusedDate()[1] + args.get_step();       
          alert(m_names[monthNumber-1]);
      }
     
    Shinu.
  3. Brown
    Brown avatar
    48 posts
    Member since:
    Dec 2010

    Posted 12 Jan 2011 Link to this post

    Hi Shinu.. It is showing wrong month name.....like if i click on the navigation button in jan month is showing april.....instead of feb.... could you tell me how to correct this...
  4. Brown
    Brown avatar
    48 posts
    Member since:
    Dec 2010

    Posted 12 Jan 2011 Link to this post

    Hi Shinu.
         I got the month name thanks for your immediate help.

    I have a another question : 
     In my front page (aspx) I am assinging the monthname to textbox  (month number) .
     I need to get that textbox value in my aspx.cs page.. how can i do that.. Could you please let me know how to do this?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2011 Link to this post

    Hello Brown,

    You can access the TextBox value as TextBox1.Value. Here is the sample code

    CSS:
    function OnCalendarViewChanged(sender, args)
       {
           var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
           var monthNumber = sender.get_focusedDate()[1] + args.get_step();
           alert(m_names[monthNumber - 1]);
           var txt = document.getElementById("TextBox1");//setting the value
           txt.value=monthNumber;  
       }

    And from CS page you can access like below:
    protected void Button1_Click(object sender, EventArgs e)
       {
           Response.Write(TextBox1.Text);
       }

    Thanks,
    Shinu.
  6. Brown
    Brown avatar
    48 posts
    Member since:
    Dec 2010

    Posted 13 Jan 2011 Link to this post

    Hi Shinu....

     It is not bringing any values..in the cs page.. it is not going inside the fun.....could you tell me what is the pbm?
  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Jan 2011 Link to this post

    Hello,

    Have you attached the event handler to RadCalender properly?

     

           <telerik:RadCalendar ID="RadCalendar1" runat="server">
                    <ClientEvents OnCalendarViewChanged="OnCalendarViewChanged" />

     

    PS: If you are using RadTextBox, then you need to use set_value() method to set the textbox value. 



    Thanks,
    Princy.

  8. Brown
    Brown avatar
    48 posts
    Member since:
    Dec 2010

    Posted 14 Jan 2011 Link to this post

    I did the same ...but i am not using the radtextbox...
Back to Top