0

I have this JS in my aspx:

 var calendar = $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: ''
                },
                defaultView: 'resourceNextWeeks',
                numberOfWeeks: <%# GetNumWeeks() %>,
...

and in my page's cs:

   public string GetNumWeeks()
        {
            return "2";
        }

But it does not do anything...

Is there another way to do it?

Thanks

5
  • Look at the generated source. Commented Mar 6, 2013 at 20:50
  • Does it compile? and are you aware of razor? Commented Mar 6, 2013 at 20:51
  • @gdoron it's probably web forms Commented Mar 6, 2013 at 20:52
  • @RenanMalkeStigliani, almost forgot its existence, damn, did you have to remember it?! Commented Mar 6, 2013 at 20:54
  • <%# is for databinding, <%= is for direct writing. Commented Mar 6, 2013 at 20:56

2 Answers 2

2

Try changing your code to:

numberOfWeeks: <% =GetNumWeeks() %>
Sign up to request clarification or add additional context in comments.

Comments

0

Why you use code behind. You can create another function and call the function siply for

var calendar = $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: ''
                },
                defaultView: 'resourceNextWeeks',
                numberOfWeeks: GetNumWeeks() ,
...


.
.
.

function GetNumWeeks()
        {
            return "2";
        }

Edit:

or You can use WebMethod

please see this sample :

1 Comment

I think he put that 2 just as an example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.