ttist25
asked on
ASP.NET MVC App - trouble getting data
Hey there,
Not sure exactly the best way to approach this because I don't really know what I'm doing but, I guess that's why I'm here! :)
Anyway - I have created an ASP.NET MVC 2 Web Application in Visual Studio 2010. I'm trying to get a working version of the DHTMLXScheduler component on my page using the tutorial located HERE. The tutorial is in C# but my application has to be in VB (I'll be working with another programmer after he gets back from vacation so I'm trying to pull the load for two weeks).
So, I have taken the .cs specific bits and translated them using THIS which seems to have worked fairly well because I can get the calendar displayed on my Index.aspx view. So the first part of the tutorial is working for me. I've got the view displaying the calendar.
The trouble comes in step 2 which involves getting data to display in the calendar. To describe the problem behavior - I run the application from the IDE and it starts to load the page but, I get a dialog box that has what looks like the contents of an asp.net server error page. The following looks like the important bits (I have stripped out some of the tags that were in the dialog box to make it easier for you to read):
Compiler Error Message: </b>BC30451: 'foreach' is not declared. It may be
inaccessible due to its protection level.
Source Error:
Line 1: <%@ Page Language="VB" Inherits="System.Web. Mvc.ViewPa ge" ContentType="text/xml " %>
Line 2: <data>
<% foreach (var myevent in Model) { %>
Line 4: <event id="<%=myevent.id% >" >
Line 5: <start_date><![CD ATA[<%= String.Format("{0:MM/ dd/yyyy HH:mm}",myevent.start _date) %>]]></start_date ></pre> </code>
So it looks like the problem is somewhere in Data.aspx which contains the following code:
Any idea where I might have gone wrong? From googling around I'm thinking I've left something out that the VB needs and C# doesn't but I wouldn't even begin to know what that is.
There are a bunch of pieces to this and I'd be happy to post anything you might need.
Thanks in advance for any help.
B
Not sure exactly the best way to approach this because I don't really know what I'm doing but, I guess that's why I'm here! :)
Anyway - I have created an ASP.NET MVC 2 Web Application in Visual Studio 2010. I'm trying to get a working version of the DHTMLXScheduler component on my page using the tutorial located HERE. The tutorial is in C# but my application has to be in VB (I'll be working with another programmer after he gets back from vacation so I'm trying to pull the load for two weeks).
So, I have taken the .cs specific bits and translated them using THIS which seems to have worked fairly well because I can get the calendar displayed on my Index.aspx view. So the first part of the tutorial is working for me. I've got the view displaying the calendar.
The trouble comes in step 2 which involves getting data to display in the calendar. To describe the problem behavior - I run the application from the IDE and it starts to load the page but, I get a dialog box that has what looks like the contents of an asp.net server error page. The following looks like the important bits (I have stripped out some of the tags that were in the dialog box to make it easier for you to read):
Compiler Error Message: </b>BC30451: 'foreach' is not declared. It may be
inaccessible due to its protection level.
Source Error:
Line 1: <%@ Page Language="VB" Inherits="System.Web.
Line 2: <data>
<% foreach (var myevent in Model) { %>
Line 4: <event id="<%=myevent.id%
Line 5: <start_date><![CD
So it looks like the problem is somewhere in Data.aspx which contains the following code:
<%@ Page Language="VB" Inherits="System.Web.Mvc.ViewPage" ContentType="text/xml" %>
<data>
<% foreach (var myevent in Model) { %>
<event id="<%=myevent.id%>">
<start_date><![CDATA[<%= String.Format("{0:MM/dd/yyyy HH:mm}",myevent.start_date) %>]]></start_date>
<end_date><![CDATA[<%= String.Format("{0:MM/dd/yyyy HH:mm}",myevent.end_date) %>]]></end_date>
<text><![CDATA[<%= myevent.text%>]]></text>
</event>
<% } %>
</data>
Any idea where I might have gone wrong? From googling around I'm thinking I've left something out that the VB needs and C# doesn't but I wouldn't even begin to know what that is.
There are a bunch of pieces to this and I'd be happy to post anything you might need.
Thanks in advance for any help.
B
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks again
ASKER
Ugh - I'm such an IDIOT! Your solution fixed everything. When I ran the application the calendar was defaulting to July 2010 instead of the current month so the dates I had added didn't show.
Kick Kick Kick :P
Thanks again!
Kick Kick Kick :P
Thanks again!
No problem, it always work for me to go away for a walk or have a break if I am stuck.
ASKER
That got rid of the error. No data is loading into the calendar but it's not throwing the error. Here's what I have in Data.aspx now:
Open in new window
I need to stop looking at it for the night and check that link in the morning.
Thanks a bunch. That was a great help.