草庐IT

parse_page

全部标签

c# - ASP.NET MVC : What is the correct way to redirect to pages/actions in MVC?

我是MVC的新手,但不确定究竟是哪个重定向...替换WebForms中使用的标准重定向是标准的Response.Redirect()例如,我需要在几个场景中重定向到其他页面:当用户注销时(操作中的表单注销​​)我想重定向到登录页面。在Controller或基本Controller事件中,例如Initialize,我想重定向到另一个页面(AbsoluteRootUrl+Controller+Action)似乎在某些情况下调用多个重定向会导致错误,这与页面已经被重定向有关吗?如何取消当前请求,只重定向?更新:这个问题的答案(System.Web.Mvc.ControllerInitiali

c# - 如何在页面基类中执行Page_Load()?

我有以下PerformanceFactsheet.aspx.cs页面类publicpartialclassPerformanceFactsheet:FactsheetBase{protectedvoidPage_Load(objectsender,EventArgse){//dostuffwiththedataextractedinFactsheetBasedivPerformance.Controls.Add(this.Data);}}其中FactsheetBase定义为publicclassFactsheetBase:System.Web.UI.Page{publicMyPageD

c# - 如何在页面基类中执行Page_Load()?

我有以下PerformanceFactsheet.aspx.cs页面类publicpartialclassPerformanceFactsheet:FactsheetBase{protectedvoidPage_Load(objectsender,EventArgse){//dostuffwiththedataextractedinFactsheetBasedivPerformance.Controls.Add(this.Data);}}其中FactsheetBase定义为publicclassFactsheetBase:System.Web.UI.Page{publicMyPageD

c# - 尝试浏览 *.cshtml 文件时出现 "This type of page is not served."错误

我刚刚创建了一个新的MVC4WebAPI项目,并创建了一个新的.cshtml文件,其中包含非常简单的HTML:打开URL时显示以下错误:ServerErrorin'/'Application.Thistypeofpageisnotserved.Description:Thetypeofpageyouhaverequestedisnotservedbecauseithasbeenexplicitlyforbidden.Theextension'.cshtml'maybeincorrect.PleasereviewtheURLbelowandmakesurethatitisspelledc

c# - 尝试浏览 *.cshtml 文件时出现 "This type of page is not served."错误

我刚刚创建了一个新的MVC4WebAPI项目,并创建了一个新的.cshtml文件,其中包含非常简单的HTML:打开URL时显示以下错误:ServerErrorin'/'Application.Thistypeofpageisnotserved.Description:Thetypeofpageyouhaverequestedisnotservedbecauseithasbeenexplicitlyforbidden.Theextension'.cshtml'maybeincorrect.PleasereviewtheURLbelowandmakesurethatitisspelledc

c# - Sys.WebForms.PageRequestManagerParserErrorException : The message received from the server could not be parsed

我的页面上有一个GridView,我想将它导出到Excel工作表,下面是我为完成此任务而编写的代码,这里我已经将数据集传递给绑定(bind)网格的方法,btnExcelExport是将网格内容导出到Excel工作表的按钮:-privatevoidBindGridView(DataSetds){if(ds.Tables.Count>0){if(ds.Tables[0].Rows.Count>0){GVUserReport.DataSource=ds;GVUserReport.DataBind();btnExcelExport.Visible=true;}}}protectedvoidbt

c# - Sys.WebForms.PageRequestManagerParserErrorException : The message received from the server could not be parsed

我的页面上有一个GridView,我想将它导出到Excel工作表,下面是我为完成此任务而编写的代码,这里我已经将数据集传递给绑定(bind)网格的方法,btnExcelExport是将网格内容导出到Excel工作表的按钮:-privatevoidBindGridView(DataSetds){if(ds.Tables.Count>0){if(ds.Tables[0].Rows.Count>0){GVUserReport.DataSource=ds;GVUserReport.DataBind();btnExcelExport.Visible=true;}}}protectedvoidbt

c# - 在回发时,如何检查 Page_Init 事件中哪个控件导致回发

在回发时,如何在Page_Init事件中检查哪个控件导致回发。protectedvoidPage_Init(objectsender,EventArgse){//needtocheckherewhichcontrolcausepostback?}谢谢 最佳答案 我看到已经有一些很好的建议和方法建议如何获得回发控制。然而,我发现另一个网页(Maheshblog)具有检索回发控件ID的方法。我会将它稍作修改后发布在这里,包括将其设为扩展类。希望它在这方面更有用。//////GetstheIDofthepostbackcontrol.//

c# - 在回发时,如何检查 Page_Init 事件中哪个控件导致回发

在回发时,如何在Page_Init事件中检查哪个控件导致回发。protectedvoidPage_Init(objectsender,EventArgse){//needtocheckherewhichcontrolcausepostback?}谢谢 最佳答案 我看到已经有一些很好的建议和方法建议如何获得回发控制。然而,我发现另一个网页(Maheshblog)具有检索回发控件ID的方法。我会将它稍作修改后发布在这里,包括将其设为扩展类。希望它在这方面更有用。//////GetstheIDofthepostbackcontrol.//

c# - 什么更好 : int. TryParse 或 try { int.Parse() } catch

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭8年前。Improvethisquestion我知道..我知道...性能不是这里的主要关注点,只是出于好奇,什么更好?boolparsed=int.TryParse(string,outnum);if(parsed)...或try{int.Parse(string);}catch(){dosomething...}