随笔分类 - .Net_MVC
摘要:<asp:DropDownList ID="DropDownList_spec" runat="server" ></asp:DropDownList>数据绑定: DataTable dt = c_pub.GetSqlTable(strSQL); DropDownList_spec.DataSource = dt; DropDownList_spec.DataTextField = "StyleName"; DropDownList_spec.DataValueField = "StyleId&quo
阅读全文
摘要:Session 不单单可以保存一个值,还可以保存一个类的实例Product pb = (Product)Session["session_product"];
阅读全文
摘要:客户端ID : <服务器控件ID>.ClientID
阅读全文
摘要:用户控件 继承:System.Web.Mvc.ViewUserControl<Cot.Products> Cot.Products: 范型 Model: 在当前控件可用 Model 取值, 比如 Model.Id (前提 (new Cot.Products()).Id 必须存在) ViewData[] : 可用ViewData["name"]方式取值Web窗体 继承 :System.Web.Mvc.ViewPage<AdminBase> AdminBase:范型 Model: 在当前控件可用 Model 取值, 比如 Model.Id (前提 (ne
阅读全文
摘要:页面调用(.aspx)<%@ Register Src="~/myspace/UC/Friend_Diary.ascx" TagPrefix="uc" TagName="friend" %><uc:friend runat="server" UserID="3333" />后台调用(.cs)UserControl Member_Friend = (UserControl)LoadControl("UC/Member_Friend.ascx");righ
阅读全文
摘要:<HeaderTemplate> 元素中的内容在输出中仅出现一次<ItemTemplate> 元素的内容会对应 DataSet 中的 "record" 重复出现<FooterTemplate> 的内容在输出中仅出现一次<AlternatingItemTemplate> 您可以在 <ItemTemplate> 元素后添加 <AlternatingItemTemplate> 元素,这样就可以描述交替行的外观了。<SeparatorTemplate>元素能够用于描述每个记录之间的分隔符。比分隔符直
阅读全文
摘要:?? : 如果"??" 运算符左操作数非空, 返回左操作数,如果"??" 运算符左操作数为空, 或者是没定义的, 则返回右操作数.例子:int a = b ?? 1; //b 未定义 所以等价于 int a=1;string s=null;string sb= s ?? ""; //s为空, 所以等价于 string sb="";string s="我不是null的哦!";string sb=s ?? ""; //s不为空, 所以等价于 string sb="我不是
阅读全文
摘要:简单的说 access 神经病的update 时传参数要按顺序传错误:OleDbParameter[] parameters = new OleDbParameter[]{ AccessHelper.Parameter("@name", name) AccessHelper.Parameter("@content", content,OleDbType.LongVarWChar)};正确:OleDbParameter[] parameters = new OleDbParameter[]{ AccessHelper.Parameter("@co
阅读全文
摘要:访问类型名称数据库数据类型OLEDB 类型.NET 框架类型成员名称文本VarWCharDBTYPE _ WSTRSystem.StringOleDbType.VarWChar备忘录LongVarWCha RDBTYPE _ WSTRSystem.StringOleDbType.LongVarWChar字节数:UnsignedTinyIntDBTYPE _ UI 1System.ByteOleDbType.UnsignedTinyInt是 / 否BooleanDBTYPE_BOOLSystem.BooleanOleDbType.Boolean日期 / 时间DateTimeDBTYPE _ DA
阅读全文
摘要:.Split (char) : 按固定字符分割函数string[] listSideContent = sideContent.Split(',');
阅读全文
摘要:1.使用传统的Response.Redirect例如string url = "/account/create";Response.Redirect(url);1.Server.Transfer方法: Server.Transfer("m2.aspx");//页面转向(服务器上执行)。服务器停止解析本页,保存此页转向前的数据后,再使页面转向到m2.aspx, 并将转向前数据加上m2.aspx页结果返回给浏览器。 2.Server.Execute方法: Server.Execute("m2.aspx"); 服务器保存此页转向前的数据后,
阅读全文
摘要:public ActionResult Temp() { return Content("Hi there!"); }
阅读全文