如果连接字符串Trusted_Connection=true使用SQL Server身份验证模式指定,我的Web应用程序的性能是否会受到影响?
假设我想使用EditForm,但我希望值绑定在每次用户输入控件时触发,而不是仅仅在模糊时触发。
举个例子,假设我想要一个InputNumber<int>这样做的?我试过使用不同的方法,但bind-Value:event="oninput"没有成功。通过复制 AspNetCore 源代码InputNumber并覆盖/重写一些东西,我终于能够或多或少地获得我想要的东西。
这是我的InputNumber<int>,它实现了我所希望的:
public class MyInputNumber: InputNumber<int>
{
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.OpenElement(0, "input");
builder.AddAttribute(1, "step", "any");
builder.AddMultipleAttributes(2, AdditionalAttributes);
builder.AddAttribute(3, "type", "number");
builder.AddAttribute(4, "class", CssClass);
builder.AddAttribute(5, "value", FormatValue(CurrentValueAsString));
builder.AddAttribute(6, "oninput", EventCallback.Factory.CreateBinder<string>(this, __value => CurrentValueAsString = __value, CurrentValueAsString));
builder.CloseElement();
}
// Copied from AspNetCore - src/Components/Components/src/BindConverter.cs
private static string FormatValue(string value, CultureInfo culture = null) => FormatStringValueCore(value, culture);
// Copied from AspNetCore - src/Components/Components/src/BindConverter.cs
private static string …Run Code Online (Sandbox Code Playgroud) 编辑:这些例子都应该有效.我的问题实际上与epplus无关,此代码以及标记的答案适用于样式合并单元格.
我希望能够为合并的单元格设置样式,但是,我尝试设置它的样式没有任何效果.这是我如何合并细胞:
WorkSheet.Cells["A1:K1"].Merge = true;
Run Code Online (Sandbox Code Playgroud)
以下是我尝试在此合并单元格上设置背景和字体颜色的方法:
WorkSheet.Cells["A1:K1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
WorkSheet.Cells["A1:K1"].Style.Fill.BackgroundColor.SetColor(Color.Black);
WorkSheet.Cells["A1:K1"].Style.Font.Color.SetColor(Color.Red);
Run Code Online (Sandbox Code Playgroud)
我试过的另一种方式:
WorkSheet.Cells["A1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
WorkSheet.Cells["A1"].Style.Fill.BackgroundColor.SetColor(Color.Black);
WorkSheet.Cells["A1"].Style.Font.Color.SetColor(Color.Red);
Run Code Online (Sandbox Code Playgroud)
我试过的另一种方式:
WorkSheet.Cells[1, 1].Style.Fill.PatternType = ExcelFillStyle.Solid;
WorkSheet.Cells[1, 1].Style.Fill.BackgroundColor.SetColor(Color.Black);
WorkSheet.Cells[1, 1].Style.Font.Color.SetColor(Color.Red);
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?我可以设置其他没有合并的单元格,但我合并的单元格不会改变.