ASP.NET MVC2 ѧϰ±Ê¼ÇÖ®URL·ÓÉ
н¨Ò»¸öĬÈϵÄASP.NET MVC2Ó¦ÓóÌÐò£¬ÏµÍ³»áĬÈϵÄÉú³É°üº¬»ù±¾¹¦ÄܵÄÓ¦ÓóÌÐò£¬²é¿´ÕâЩÉú³ÉµÄ´úÂ룬¿É°ïÖúÎÒÃÇÀí½âASP.NET MVC2¡£ÏÂÃæÊǶÔURL·ÓɵÄÀí½â£¬ÒÔ±¸Íü¡£
Ò»¡¢Global.asax.csÖеĴúÂ룺
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "About", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
}
Application_StartÊÇÍøÕ¾Æô¶¯ºó×îÏÈÖ´ÐеÄʼþ£¬ËùÒÔ¶ÔÍøÂç·ÓɵÄÉèÖ÷ÅÔÚ´Ë´¦£¬¾ßÌåͨ¹ý·½·¨routes.MapRoute("Default",¡¡"{controller}/{action}/{id}",¡¡ new {controller = "Home", action = "Index", id = ""}¡¡);ʵÏÖ£¬·½·¨µÄµÚÒ»¸ö²ÎÊýÊÇ·ÓɵÄÃû×Ö£
Ïà¹ØÎĵµ£º
Ҫʹ ASP.NET Web Ó¦ÓóÌÐòÄܹ»Ê¹Óÿͻ§¶ËÖ¤Ê飬Äú±ØÐëÔÚ±¾µØ¼ÆËã»ú´æ´¢Öа²×°¿Í»§¶ËÖ¤Êé¡£Èç¹ûÄúÔÚ±¾µØ¼ÆËã»ú´æ´¢Öа²×°¿Í»§¶ËÖ¤Ê飬Ôò¸Ã¿Í»§¶ËÖ¤Êé½ö¶Ô¹ÜÀíÔ±×éÖеÄÓû§ÕÊ»§ºÍ°²×°¸Ã¿Í»§¶ËÖ¤ÊéµÄÓû§¿ÉÓá£Òò´Ë£¬Äú±ØÐëÏòÓÃÓÚÔËÐÐ ASP.NET Web Ó¦ÓóÌÐòµÄÓû§ÕÊ»§ÊÚȨ£¬Ê¹ÆäÄܹ»·ÃÎÊ¿Í»§¶ËÖ¤Êé¡£
×¢Ò⣺±ØÐë°²×° Microso ......
ÔÚѧϰ¹ý³ÌÖÐÐèÒªÓõ½CookieÎļþ£¬ÔÚÍøÉÏÕÒÁËЩÏà¹ØµÄ֪ʶ£¬Ñ§Ï°ÁËÒ»²¿·Ö£¬ÏּǼÈçÏ£º
£¨1£©
HttpCookie myHttpCookie = new HttpCookie("MyWebSite");
DateTime myDateTime = System.DateTime.Now;
TimeSpan myTimeSpan = new TimeSpan();
if (rbHour.Checked == true)
{
myTimeSpan = new Ti ......
×î½üµÄÏîÄ¿¿ª·¢ÖÐ Óöµ½Ò»Ð©ÐèÒª¸ù¾Ý¾ßÌåÇé¿ö¶¯Ì¬Ìí¼ÓjavaScript½Å±¾£¬È»ºóÖ´Ðнű¾ ÓÚÊÇÊÕ¼¯ÁËһϣº
1 ÔڿؼþµÄ°ó¶¨Ê¼þÖÐÌí¼Ó½Å±¾ È磺ÔÚgridview¿Ø¼þµÄrowdatabindʼþÖпÉÒÔʵÏÖ Ö¸ÕëµÄÑ¡ÖÐÐв»Í¬É«ÏÔʾ ¿ÉÌí¼Ó½Å±¾
protected void gvEngineerRepairState_RowDataBound(object sender, GridViewRowEventArgs e ......
Êý¾Ý°ó¶¨¿Ø¼þ±È½Ï(Reapter\DataList\GridView\DatailsView\FormView):
1.²åÈ빦ÄÜ·½Ãæ:
DetailsViewºÍFormView¾ßÓвåÈ빦ÄÜ,ÆäËü¿Ø¼þûÓÐ
2.Ä£°å
DataList\FormView\RepeaterÈýÖÖ±ØÐë±à¼Ä£°å,¶ø
GridViewºÍDetailsViewÖ»ÓÐÔÚ½«ÁÐת»»³ÉÄ£°åÁÐÒÔºó²Å»á³öÏÖ¸÷ÖÖÄ£°å.
3.×Ô¶¯·ÖÒ³¹¦ÄÜ
GridView ,DetailsViewºÍFormView ......
1. Êʵ±Ê¹ÓÃUpdatePanel
2. ÀûÓÃWebService·½·¨¶¯Ì¬Éú³ÉÓû§¿Ø¼þµÄÄÚÈÝ£¬±ÜÃâUpdatePanel»Ø´«Ôì³ÉµÄÐÔÄÜËðʧ£¨ViewState£©
3. ToolkitScriptManager´úÌæScriptManager
4. <asp:ScriptManager runat="server" ID="sm" ScriptMode="Release" EnablePartialRendering="false"
......