2013-0801

tooltip要手动激活的好不好,还有那个popover,需要tooltip跟手动激活。

下面来说说那个tooltip的使用,先引用下官方的原话:

For performance reasons,  

the tooltip and popover data-apis are opt in,  

meaning you must initialize them yourself.




翻译过来就是:出于性能原因的考虑,tooltip和popover的data-apis是可... 阅读全文>>

标签: bootstrap tooltip 阅读:13555
2013-0730

MVC使用Ajax.BeginForm上传图片时HttpPostedFileBase file为null,Request.Files获取不到文件,问题分析是页面中存在jquery.unobtrusive-ajax.js文件,注释后能够获取到。改为Html.BeginForm实现如下:

@using (Html.BeginForm("UploadPhoto", "EditUserInfo", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
选择图片:
<input type="file" name="uploa 阅读全文>>
                
标签: mvc Ajax.BeginForm HttpPostedFileBase 图片上传 文件上传 阅读:37049
2013-0730

百度接口相关说明:http://developer.baidu.com/map/ip-location-api.htm

返回是json格式,首先构建相关反系列化类:

#region AddressForQueryIPFromBaidu
[Serializable]
public class AddressForQueryIPFromBaidu
{
    public string Address { get; set; }
    public Content Content { get; set;  阅读全文>>
                
标签: C# 百度API 通过IP获取位置 IP获取坐标 阅读:21957
2013-0730

正则表达式用于字符串处理、表单验证等场合,实用高效。现将一些常用的表达式收集于此,以备不时之需。

匹配中文字符的正则表达式: [\u4e00-\u9fa5]
评注:匹配中文还真是个头疼的事,有了这个表达式就好办了

匹配双字节字符(包括汉字在内):[^\x00-\xff]
评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)

匹配空白行的正则表达式:\n\s*\r
评注:可... 阅读全文>>

标签: 常用正则表达式 Email正则表达式 URL正则表达式 电话正则表达式 身份证正则表达式 阅读:9430
2013-0725

在asp.net mvc的强类型视图(strongly typed view)使用下拉列表,在Controller中设定的选择项在View上选中失效


下面是我的代码:

public ActionResult Create(int id=0,int parentid=0)
{
    var productCategory=db.ProductCategorys.Where(pc => pc.ParentID == parentid).ToList();
    productCategory.Insert(0,new ProductCategoryModel() { Name = "顶级分 阅读全文>>
                
标签: ASP.NET MVC SelectList selected 阅读:11021
2013-0724

mvc使用Area分区开发后,存在在不同Area间跳转,需要为每个区间添加Area规则,如下:

public class CompanyAreaRegistration : AreaRegistration
{
    public override string AreaName
    {
        get
        {
            return "Company";
        }
    }
    public override void RegisterArea(AreaRegistrationContext context)
    {
        context 阅读全文>>
                
标签: ASP.NET MVC RedirectToAction Area 阅读:20093