This is a migrated thread and some comments may be shown as answers.
Getting month name
7 Answers 66 Views
This is a migrated thread and some comments may be shown as answers.
Brown
Top achievements
Rank 1
Brown asked on 11 Jan 2011, 07:31 PM
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?

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 12 Jan 2011, 08:15 AM
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.
0
Brown
Top achievements
Rank 1
answered on 12 Jan 2011, 02:28 PM
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...
0
Brown
Top achievements
Rank 1
answered on 12 Jan 2011, 06:44 PM
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?
0
Shinu
Top achievements
Rank 1
answered on 13 Jan 2011, 05:21 AM
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.
0
Brown
Top achievements
Rank 1
answered on 13 Jan 2011, 03:11 PM
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?
0
Princy
Top achievements
Rank 1
answered on 14 Jan 2011, 01:46 PM
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.

0
Brown
Top achievements
Rank 1
answered on 14 Jan 2011, 03:47 PM
I did the same ...but i am not using the radtextbox...
Asked by
Brown
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Brown
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Share this question
or