模型类
[Required(ErrorMessage = "Pass word is required")]
//[ValidatePasswordLength]
[DataType(DataType.Password)]
//[Display(Name = "Password")]
public string Password { get; set; }
Run Code Online (Sandbox Code Playgroud)
视图
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Password, new {@class="form-control",placeholder="Password" })
@Html.ValidationMessageFor(model => model.Password)
</div>
Run Code Online (Sandbox Code Playgroud)
我google了它.我发现使用@html.Editor而不是@ html.TextBoxFor但我必须为文本框应用css.
我用过 @Html.TextBoxFor(model => model.Password, new {@class="form-control",placeholder="Password" })但css没有应用.我如何实现这一目标?
我目前期待有人就我将要推进的数据库归档过程向我提出建议。
我有数据库 (DB-1),它有 2 个非常大的表,一个表有 25 GB 的数据,另一个是 20 GB 的数据。即使我有索引,这也会导致主要的性能问题。
因此,我们考虑使用以下过程归档旧数据,
Radion按钮:
<div class="control-group">
<label class="control-label">Mode</label>
<div class="controls">
<asp:radiobuttonlist id="RadioButtonList1" cssclass="radio" autopostback="true" title="Please Select Mode of Payment"
repeatdirection="Horizontal"
onselectedindexchanged="RadioButtonList1_SelectedIndexChanged">
<asp:listitem>Cash</asp:listitem>
<asp:listitem>Cheque</asp:listitem>
<asp:listitem>Demand Draft</asp:listitem>
<asp:listitem>Net Banking</asp:listitem>
</asp:radiobuttonlist>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我已经应用了Bootstrap css:
一切看起来很好,除了radiobutton列表,看起来很可怕:

怎么解决这个?
我试图在文本文件上写一个字符串,但它没有写任何东西,没有例外.我的代码是:
public void CreateLog(string sLogInfo)
{
string sDestionation = null;
string sFileName = DateTime.Now.ToString("yyyyMMdd") + "_log.txt";
sDestionation = @"D:\Log\";
//sDestionation = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + ConfigurationManager.AppSettings["DestinationPath"].ToString();
string sFile = sDestionation + sFileName;
if (!System.IO.Directory.Exists(sDestionation))
{
System.IO.Directory.CreateDirectory(sDestionation);
}
StreamWriter oWriter = null;
if (!System.IO.File.Exists(sFile))
{
oWriter = File.CreateText(sFile);
}
else
{
oWriter = File.AppendText(sFile);
}
oWriter.WriteLine(DateTime.Now.ToString() + ": " + sLogInfo.Trim());
}
Run Code Online (Sandbox Code Playgroud) 当PushNotificationData客户端请求以方法建立集线器连接时,我启动了一个计时器。
根据计时器间隔,它确实从数据库中获取记录并推送到客户端。但是当客户端断开连接时,这个计时器必须停止而不是连续拉动。
所以我使用 OnDisconnected 事件来停止计时器。但不幸的是计时器没有停止
这是我的代码:
public class NotifyHub : Hub
{
private string ConnectionId;
private int UserId;
private int UserTypeId;
Timer timer = new Timer();
public override Task OnConnected()
{
ConnectionId = Context.ConnectionId;
return base.OnConnected();
}
public override Task OnDisconnected(bool stopCalled)
{
timer.Stop();
timer.Enabled = false;
//logic code removed for brevity
return base.OnDisconnected(stopCalled);
}
public void PushNotificationData(Int32 userId, Int16 userTypeId)
{
UserId = userId;
UserTypeId = userTypeId;
ConnectionId = Context.ConnectionId;
timer.Elapsed += Timer_Elapsed1;
timer.Interval = 6000;
timer.Enabled …Run Code Online (Sandbox Code Playgroud) 我正在使用MVC5和EF6.我得到以下转换错误
无法隐式转换
System.Collections.Generic.List<TreaceabilitySystem.GLB_M_PROFITCENTER>为System.Collections.Generic.List<TreaceabilitySystem.Models.Profitcenter>
private TSEntities db = new TSEntities();
// GET: Profitcenter
public ActionResult Index()
{
List<Profitcenter> profitcenter = new List<Profitcenter>();
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)profitcenter = db.GLB_M_PROFITCENTER.ToList(); //Error coming up here
return View(profitcenter.ToList());
}
Run Code Online (Sandbox Code Playgroud)
我的模型在这里:当我在.edmx中添加表时,通过EF创建此模型
public partial class GLB_M_PROFITCENTER
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public GLB_M_PROFITCENTER()
{
this.GLB_M_USERMASTER = new HashSet<GLB_M_USERMASTER>();
}
public string PROFITCENTER_CODE { get; set; }
public string PROFITCENTER_NAME { get; set; }
public string DESCRIPTION { get; set; }
public bool ISACTIVE { get; set; }
public int CREATEDBY …Run Code Online (Sandbox Code Playgroud) 我正在尝试定期从共享驱动器中删除应用程序日志,
ForFiles /p "\\netapp-1\Transfers\Logs\QA" /s /d -15 /c "cmd /c del @file"
Run Code Online (Sandbox Code Playgroud)
当路径是我的本地驱动器时,上述命令有效,但不适用于共享驱动器,任何帮助将不胜感激。
干杯!
我有两个文本框,我正在尝试填充Textbox1的更改事件中的第二个文本框
例如:当我在TextBox1输入客户代码时,我必须填写客户名称.
我的剧本:
$(document).ready(function() {
userCodeChangeEvent();
});
function userCodeChangeEvent() {
$('#<%=txtCustomerCode.ClientID %>').change(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Customer_Bill.aspx/GetNameByCode",
data: "{'CusName':'" + document.getElementById('<%=txtCustomerCode.ClientID %>').value + "'}",
dataType: "json",
success: function(data) {
$('#<%=txtcustomerName.ClientID %>').value = data.d;
},
error: function(result) {
alert("No Match");
}
});
});
}
Run Code Online (Sandbox Code Playgroud)
C#:
[WebMethod]
public static string GetNameByCode(string CusName)
{
// List<string> empResult = new List<string>();
string empResult = "";
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Constring"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText …Run Code Online (Sandbox Code Playgroud) asp.net ×4
c# ×4
asp.net-mvc ×2
archiving ×1
batch-file ×1
cmd ×1
css ×1
jquery ×1
json ×1
postgresql ×1
razor ×1
signalr ×1
sql-server ×1
timer ×1
unc ×1
windows ×1
winforms ×1