随笔分类 -  ASP.NET

摘要:首先,在Solution Explorer下新建一个Areas文件夹。 然后右击该文件夹,选择“Add” -> “Area”,新建Area。如下所示: 然后分别设置其相应的Controller和View。 AnotherController.cs [Area("AnotherArea")] publ 阅读全文
posted @ 2020-07-15 17:19 Kyle0418 阅读(1323) 评论(0) 推荐(0) 编辑
摘要:首先,新建一个edmx绑定数据库中的表。 JsonController.cs public class JsonController : Controller { // GET: Json public ActionResult Index() { return View(); } [HttpPos 阅读全文
posted @ 2020-07-09 17:36 Kyle0418 阅读(1078) 评论(0) 推荐(0) 编辑
摘要:以下是使用Chart.JS绘制Gauge图的例子。 WebForm.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="chartjs.WebForm1" %> <!DO 阅读全文
posted @ 2020-07-08 16:02 Kyle0418 阅读(916) 评论(0) 推荐(0) 编辑
摘要:WebForm1.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="sweetalert.WebForm1" %> <!DOCTYPE html> <html xmln 阅读全文
posted @ 2020-06-30 15:23 Kyle0418 阅读(392) 评论(0) 推荐(0) 编辑
摘要:首先,声明一个学生类。 public class Student { public string Name { get; set; } public string Age { get; set; } } 在页面首次打开时,使用DataSource属性和DataBind方法为GridView绑定数据源 阅读全文
posted @ 2020-06-22 14:56 Kyle0418 阅读(949) 评论(0) 推荐(0) 编辑
摘要:首先,新建一个ASP.NET项目,然后添加新项“Web Service(.asmx)”,命名为MathService。向类中添加方法,注意:只有包含WebMethod特性的方法才可以作为Web服务进行远程访问。 public class MathService : System.Web.Servic 阅读全文
posted @ 2020-06-22 11:19 Kyle0418 阅读(628) 评论(0) 推荐(0) 编辑
摘要:定义自定义控件: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="TemplateTest.WebUserControl1" %> <asp:Label I 阅读全文
posted @ 2020-06-18 13:12 Kyle0418 阅读(180) 评论(0) 推荐(0) 编辑
摘要:Model: public class TestModel { [Required] public string Id { get; set; } } Controller: public class TestController : Controller { // GET: Test public 阅读全文
posted @ 2020-06-16 16:09 Kyle0418 阅读(1529) 评论(0) 推荐(0) 编辑
摘要:Model: public class TestModel { [Required] public string Id { get; set; } } Partial View(PartialInput.cshtml): @model partialview.Models.TestModel @us 阅读全文
posted @ 2020-06-16 11:03 Kyle0418 阅读(557) 评论(0) 推荐(0) 编辑
摘要:例如,访问wwwroot下的files/file.pdf public class SendEmailController : Controller { public IActionResult Index() { return View(); } private IWebHostEnvironme 阅读全文
posted @ 2020-06-12 10:29 Kyle0418 阅读(4075) 评论(0) 推荐(0) 编辑
摘要:由于.Net Core中不再支持HttpPostedFileBase类,因此文件的上传可以使用IFormFile代替。 具体方法如下: 同样,先创建一个Model类来存放数据, public class EmailModel { public string To { get; set; } publ 阅读全文
posted @ 2020-06-11 17:29 Kyle0418 阅读(543) 评论(0) 推荐(0) 编辑
摘要:首先创建一个Model类来存放数据, public class MailModel { [Required(ErrorMessage = "Please enter the receiver")] public string To { get; set; } public string Subjec 阅读全文
posted @ 2020-06-11 14:49 Kyle0418 阅读(572) 评论(0) 推荐(0) 编辑
摘要:调用含参方法: $("#btn").click(function () { $.ajax({ type: "Post", url: "WebForm1.aspx/GetStr", data: "{'str':'aaa','str2':'bbb'}", contentType: "applicatio 阅读全文
posted @ 2020-06-08 17:17 Kyle0418 阅读(451) 评论(0) 推荐(0) 编辑
摘要:方法:JQueryUI ListBox: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1 阅读全文
posted @ 2020-06-05 15:23 Kyle0418 阅读(215) 评论(0) 推荐(0) 编辑
摘要:In order to add responsive features to the navigation bar, the content to be collapsed must be wrapped in <div> with class “.collapse” and “.navbar-co 阅读全文
posted @ 2020-05-29 16:39 Kyle0418 阅读(354) 评论(0) 推荐(0) 编辑
摘要:To pop up a form in MVC, we can use bootstrap modal dialog to achieve it. First, define an enum in Model as the source of DropDownList. namespace Test 阅读全文
posted @ 2020-05-28 16:27 Kyle0418 阅读(387) 评论(0) 推荐(0) 编辑
摘要:In order to make each cell editable, we can use the TextBox control to fill the GridView‘s cell. We can use “TemplateField.ItemTemplate” property to s 阅读全文
posted @ 2020-05-27 15:55 Kyle0418 阅读(712) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示