小编Mr *_*r A的帖子

使用字符串格式显示最多2位的十进制或简单整数

我有一个显示的价格字段,有时可以是100或100.99或100.9,我想要的是只有在为该价格输入小数时才显示2位小数的价格,例如,如果它的100只是它应该只显示100不是100.00,如果价格是100.2,它应该显示100.20同样100.22应该是相同的.我用谷歌搜索并遇到了一些例子,但它们与我想要的完全不符:

// just two decimal places
String.Format("{0:0.00}", 123.4567);      // "123.46"
String.Format("{0:0.00}", 123.4);         // "123.40"
String.Format("{0:0.00}", 123.0);         // "123.00"
Run Code Online (Sandbox Code Playgroud)

c# regex string-formatting number-formatting

266
推荐指数
12
解决办法
66万
查看次数

如何检查输入文件是空的,如果使用jquery选择了png格式,也会显示警报

我有一个输入文件上传,需要检查上传哪个文件/如果客户端使用jquery没有选择文件.

<input type="file" name="files" id="file1" style="color:White" />
<input type="submit" value="Create" />
Run Code Online (Sandbox Code Playgroud)

单击提交时应触发检查.

html jquery file-upload

15
推荐指数
2
解决办法
5万
查看次数

如何通过sql server更改或更新asp.net成员资格中的密码

我必须更改密码别的东西,我有喜欢的所有细节userid,username,encrypted password,password format.

如何在asp.net会员资格中通过SQL更改密码?

sql asp.net asp.net-membership password-recovery sql-server-2008

13
推荐指数
1
解决办法
2万
查看次数

在asp.net中使用if with eval("")

我正在使用转发器在新闻栏目上显示新闻.在我的新闻栏目中,我有2个标签(标题,描述)和一个图像字段.下面是我用来填充转发器的代码:

<asp:Repeater ID="rptNews" runat="server">
<ItemTemplate>
<asp:Image ID="newsImage" runat="server" ImageUrl='<%#String.format("../Images/News/{0}", Eval("newsImage")) %>' />
<asp:Label ID="newsTitle" runat="server" Text='<%#Eval("newsTitle") %>'></asp:Label>
<br />
<asp:Label ID="newsDescription" runat="server" Text='<%#Eval("newsDescription") %>'></asp:Label>
<br />
<div class="clear">&nbsp;</div>
</ItemTemplate>

</asp:Repeater>
Run Code Online (Sandbox Code Playgroud)

我想使用if语句,例如,如果Eval("newsImage")为null,那么我想禁用图像控件,只显示新闻的标题和描述.关于如何实现这一点的任何建议.

.net asp.net if-statement repeater eval

9
推荐指数
1
解决办法
4万
查看次数

如何在ajax html编辑器中摆脱复制和粘贴文本样式

我正在使用ajax html编辑器进行新闻描述页面.当我复制粘贴来自word或internet的东西时,它会复制该文本的样式,段落等,它克服了html编辑器文本框的默认类样式,我想要的是摆脱下面的内联样式而不是html哪个有
我要保留到款

<span id="ContentPlaceHolder1_newsDetaildesc" class="newsDetails"><span style="font-family: arial, helvetica, sans; font-size: 11px; line-height: 14px; color: #000000; "><strong>Lorem Ipsum</strong>&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<BR /> It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in …
Run Code Online (Sandbox Code Playgroud)

html css asp.net html-editor

6
推荐指数
1
解决办法
8395
查看次数

如何使用jquery调用html.actionlink

我想用jquery调用actionlink,下面是代码:

  $("#paycheck").click(function () {

        if ($("#terms").attr("checked")) {

       //Call Html.ActionLink // This is where the html.ActionLink should be called to display another view


        } else {
            alert("Please agree to the terms and conditions.");
            return false;
        }
    });

<%: Html.ActionLink("Pay", "Index", "News") %>
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery asp.net-mvc-2

5
推荐指数
1
解决办法
1万
查看次数

在excel的特定列的每个字段中添加撇号

如何在[tag:Excel电子表格中]的每个字段中添加撇号而不单独输入?我有5k领域

在此输入图像描述

excel excel-2007

5
推荐指数
2
解决办法
11万
查看次数

使用asp.net中的datalist控件从SQL Server数据库中显示客户

我有一个1000个客户的列表,我通过asp.net中的datalist控件显示.该列表显示每页一个客户.

我用来绑定数据列表的查询是:

static public DataTable GetAllCustomers()
{
    string sql = "Select * from [Customers]";
    SqlDataAdapter da = new SqlDataAdapter(sql, ConnectionString);
    DataTable dt = new DataTable();
    da.Fill(dt);
    return dt;
}
Run Code Online (Sandbox Code Playgroud)

我想要做的是一旦客户被查看它应该回到列表的底部,这样一旦用户第二次登录,他就不必从一开始就查看同一个客户,所查看的客户应该去在1000个客户列表的底部,例如,如果一旦查看了客户1,则下次客户1应该成为1000个客户而客户2应该成为客户1时,希望它有意义.

任何建议或帮助将不胜感激如何实现此场景以及我必须在db和query中进行哪些更改才能实现此目的.

database sql-server asp.net datalist

5
推荐指数
1
解决办法
1168
查看次数

Visual Studio 2010上的发布网站失败(MVC3)

我试图使用Visual Studio 2010中的解决方案资源管理器的属性中提供的发布选项发布网站,但我收到错误,下面是错误:

错误1将文件obj\Release\Package\PackageTmp\Content\css\Site.css复制到obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\Content\css\Site.css失败.找不到文件'obj\Release\Package\PackageTmp\Content\css\Site.css'

任何想法或建议,为什么会出现此错误导致发布失败.另外我检查了我的obj\Release文件夹,几乎所有文件旁边都有一个惊叹号.

asp.net-mvc publish visual-studio-2010 asp.net-mvc-2

4
推荐指数
1
解决办法
3890
查看次数

获取控制器mvc 4中的复选框值

我试图从复选框列表中检索已选中的复选框值,但没有成功,下面是我尝试过的代码:

模型

 [DisplayName("Gender")]
    public IList<SelectListItem> Gender { get; set; }
Run Code Online (Sandbox Code Playgroud)

调节器

 public ActionResult Index()
        {
            AssociateFormViewModel objStudentModel = new AssociateFormViewModel();

            List<SelectListItem> genderNames = new List<SelectListItem>();
            genderNames.Add(new SelectListItem { Text = "Male", Value = "1" });
            genderNames.Add(new SelectListItem { Text = "Female", Value = "2" });
            genderNames.Add(new SelectListItem { Text = "Prefer not to say", Value = "3" });

            objStudentModel.Gender = genderNames;
            return PartialView("AssociateApplicationForm", objStudentModel);

        }

[HttpPost]
        public ActionResult HandleFormSubmit(MembershipFormViewModel model)
        {
            //model not valid, do not save, but return current …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc controller model checkboxlist asp.net-mvc-4

4
推荐指数
1
解决办法
5万
查看次数