简体   繁体   English

ASP.Net AJAX调用c#函数

[英]ASP.Net AJAX Call c# functions

Been looking around for the last few days trying to figure out what the best route is. 最近几天一直在四处寻找,以找出最佳路线。 I am fairly new to ASP.Net so I am in need of a little assistance. 我对ASP.Net相当陌生,因此我需要一点帮助。

I like the idea of using Master Pages as it will make making changes to the template a lot easier! 我喜欢使用母版页的想法,因为它可以使对模板的更改变得更加容易! But I am running into some problems. 但是我遇到了一些问题。 I will just list them below and see where we can go, maybe this will help some other newbies like myself. 我将在下面列出他们,然后看看我们可以去哪里,也许这会对像我这样的其他新手有所帮助。


Dynamic Menu: I am trying to create a menu system that will show certain links depending on the users role. 动态菜单:我正在尝试创建一个菜单系统,该系统将根据用户角色显示某些链接。 This is simple enough until I just want the link to perform some functions and thats it. 这很简单,直到我只希望链接执行某些功能即可。 So I dont want it to postback or anything. 所以我不希望它回发或其他任何东西。 So my next step was to try to use jQuery as I would with my php development. 因此,我的下一步是尝试像在PHP开发中一样使用jQuery。 Problem is I cant seem to get my jQUery to call the master page code behind function. 问题是我似乎无法让jQUery调用函数后面的母版页代码。 I've gone through all the tutorials I could find with WebMethods but just keep getting an error to the like of This type of page is not served. 我已经遍历了WebMethods所能找到的所有教程,但始终会遇到类似“不会提供此类页面”之类的错误。

General Classes: In PHP sometimes I would have the need to just have some General classes that pertained to a specific area of the application. 通用类:有时在PHP中,我只需要拥有一些与应用程序特定领域有关的通用类。 I would just use these to hold all the function I may need to call from jQuery. 我只是用它们来保存我可能需要从jQuery调用的所有功能。 Is there something like that in ASP.Net? ASP.Net中是否有类似的东西? I tried just adding a class but again couldn't call it from jQuery. 我尝试仅添加一个类,但再次无法从jQuery调用它。 Is this something Web Services would be good at? Web Services是否擅长于此? I am still trying to understand their full use. 我仍在尝试了解它们的充分使用。 Seems like we could use Web Services as a buffer between the client and the back end classes. 似乎我们可以将Web服务用作客户端和后端类之间的缓冲区。

I look forward to any pointers or tips! 我期待任何指示或提示!

Oded and jrummell made it very clear I should probably start with ASP.NET MVC first. Oded和jrummell明确指出,我可能应该首先从ASP.NET MVC开始。 It will most likely be an easier road for me moving from php. 对于我来说,从php迁移这将是一条更容易的路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM