You can simply and easily call a static page method from JavaScript like in this example. If you need to call the method from multiple pages, you can setup a web service and call it from Javascript the same way. Example also included below.
.aspx Code
<asp:ScriptManager ID="ScriptManager1"
EnablePageMethods="true"
EnablePartialRendering="true" runat="server" />
Code-behind Code
using System.Web.Services;
[WebMethod]
public static string MyMethod(string name)
{
return "Hello " + name;
}
Javascript Code
function test() {
alert(PageMethods.MyMethod("Paul Hayman"));
}
NOTE: The page methods have to be static. This could be problematic for you, depending on what the application is trying to do. However, if the information is based on session at all, and you're using some sort of built-in authentication, you can put an EnableSession attribute on the WebMethod decorator, and that will allow you to get at HttpContext.Current.User, Session, etc.
EDIT: To summarise, I think understand where you're coming from - at first glance, the ASP.Net MVC framework seems to have (too) many parts, and it's difficult to start understanding it. Having said this, I'd argue that you're looking at this wrong. ASP.Net MVC is not a particularly heavy MVC framework (you should compare it to PHP MVC frameworks to be fair), but yes, it is very much conventions-based. There is a lot of good reasoning behind that design choice, and your first priority in learning the framework would be to learn its conventions, and perhaps the reasoning for them. If for some reason you absolutely want to go deeper, the framework is open source, and you can dig into it here.
I can just skip frameworks altogether, and toss random PHP along with my HTML on a single file and make it work
Well, not with an MVC framework (even in PHP). You're going to at least have a model, a view, and a controller. Those are a bit of a minimum, so I'm not really sure what you're looking for here; it's an apples and oranges comparison.
After that, there's going to be a few other files that you will probably need; such as configuration for the routing, etc. This is fairly standard and comparable to PHP MVC frameworks.
If you want a "single page" model, you could try WebForms, although that technology typically tries to move logic into a separate "code behind" page. I'm pretty sure you could skip the latter, however, and have .aspx files logically identical to .php files sitting there.
Do I really need to create a whole bloat of files and folders...
The default VS project template does tend to copy a lot of potentially unnecessary stuff (scripts, etc), but you could remove most of those. Again, you will probably have a minimum number of things there. Do these really cause you major worry? Have you seen what a Symfony installation looks like?
... for the sake of convention?
Convention is a great thing. The concept is called "convention over configuration", and for most non-trivial projects, it is wonderful thing. It stops people from reinventing things, and gives standards that should be followed.
Since you mention this is a learning exercise, I would suggest that you stop worrying about these things too much. ASP.Net MVC is very much about convention, and you are doing yourself a disservice by trying to work around those. In fact, to learn MVC, you should learn the conventions as much as any of the internals.
Best Answer
I think that part of the issue you may be facing is that ASP.Net tries to manage the naming of the items for your when it's rendered to the client, so in your ASP page you may name your control "txtFirstName" but inside a nested reapeater it will look like "Repeater1$ctl00$Repeater2$ctl00$txtFirstName." You probably already know that, but the issue is when you make the objects dynamic, as loaded from the XmlDataSource, it doesn't do the mapping for you back to the name. You can still use the Request object to pull the values.
So, for example, I pulled the XmlDataSource example off of MSDN (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.aspx) and added some checkboxes to the nested repeater that contains the orders. When I click submit, just as a test, I view the Params collection from the Request object and if they contain the ID of the checkboxes I'm searching for I output their value.
Let me know if this helps, or you need more.
Below is the code
order.xml:
And the webpage: