我的页面中有两个TextBox和两个Buttons.
一个是隐藏的,另一个是显示的.
当我点击Button1
它时,它将保存两者的数据,TextBox
并将通过它验证每个TextBox RequiredFieldValidator
.
然后当我点击时Button2
,它只会隐藏自己(Button2
)并显示隐藏的内容TextBox
.
两者TextBox
都RequiredFieldValidator
验证了Button1
对话的事件点击.
现在我的问题是,当我只是在第一个TextBox中输入文本并单击"保存"时,单击按钮即可验证隐藏字段的必填字段.我只想在显示时验证2文本框.
我怎么能避免这个?
我在我的应用程序中使用 Asp.net 核心和 EF 核心。基本上我想从单个存储过程中获取多个结果集。试图搜索它过去 2 天没有这样的运气。试图找出解决方法来解决它..
这是我的存储过程:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_CustomerAll_sel]
@SomeOutput int OUT
AS
BEGIN
SET NOCOUNT ON;
SELECT *
FROM [dbo].[Customer]
SELECT @SomeOutput = @@rowcount + 25 --This number 25 is a variable from a complex query but always an integer
END
Run Code Online (Sandbox Code Playgroud)
我在那个表中有 2 条记录,所以基本上它应该返回一个客户类型的表,输出参数应该返回 27..
现在从我的 .net 代码中我到目前为止所尝试的
[HttpGet]
public async Task<Tuple<IEnumerable<Customer>, int>> GetAllCustomer()
{
var votesParam = new SqlParameter
{
ParameterName = "SomeOutput",
Value = -1,
Direction = …
Run Code Online (Sandbox Code Playgroud) 我有3个列表列表
ListMaster contains {1,2,3,4,....} ..getting populated from DB
List1 contains {1,3,4}
List2 contains {1,3,95}
Run Code Online (Sandbox Code Playgroud)
如何使用linq检查主列表中存在哪些列表项
我想为禁用按钮注册MouseEnter/MouseLeave事件.虽然它对启用的按钮有效,但它不起作用.
//Enable Disable controls on form load
EnableDisableControls("Load");
var grupButtons = control.Controls.OfType<Button>();
foreach (Button btns in grupButtons)
{
//btns.MouseMove += new MouseEventHandler(MainframeDataExchangeTool_MouseMove);
btns.MouseEnter += new EventHandler(btns_MouseEnter);
btns.MouseLeave += new EventHandler(btns_MouseLeave);
}
private void btns_MouseEnter(object sender, EventArgs e)
{
}
private void btns_MouseLeave(object sender, EventArgs e)
{
var parent = sender as Control;
string tipstring = string.Empty;
if (parent == null)
{
return;
}
string enter = sender.GetType().ToString() + ": MouseEnter";
}
Run Code Online (Sandbox Code Playgroud)
它适用于启用按钮......但是如何禁用按钮...我必须在mouseenter上显示工具提示操作并立即在mouseleave上使其消失?
是否有任何东西可以显示在 Visual Studio 中打开的所有文件的行号?
我想强制我的方法只接受一个整数参数,如果它是积极的.如果该方法传递一个负整数,它应该抛出编译时错误.实现这一目标的最佳方法是什么?
目前我在方法Math.Abs(Int)
内部使用,但我希望错误在编译时.
使用空引用检查过滤值的最简单方法是什么.Order应该像"Active","Reset","Locked","Suspended","Expired","Disabled","Revoked"
namespace ConsoleApplication1
{
class Program
{
private static void Main(string[] args)
{
var tempList = new List<string>
{
"Active",
"Reset",
"Locked",
"Suspended ",
"Expired",
"Disabled ",
"Revoked"
};
var list = new List<MyEntity>
{
new MyEntity() {MyValue = "Reset"},
new MyEntity() {MyValue = "Locked"},
new MyEntity() {MyValue = "Active"},
new MyEntity() {MyValue = "Expired"}
};
var item =
list.FirstOrDefault(x => x.MyValue));
}
}
public class MyEntity
{
public string MyValue { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能根据值将过滤器列入清单...
我用过
"^[a-zA-Z0-9]*$"
Run Code Online (Sandbox Code Playgroud)
对于字母数字没有空格它的工作
现在我必须限制只有9个字符被允许不多不少于9个
我正在尝试使用 from submit 对两个数字求和。HttpGet 工作正常,但在提交表单时,我无法在视图中显示它..
public class CalculatorController : Controller
{
//
// GET: /Calculator/
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult Sum()
{
CalculatorModel model = new CalculatorModel();
model.FirstOperand = 3;
model.SecondOperand = 4;
model.Result = model.FirstOperand + model.SecondOperand;
//Return the result
return View(model);
}
[HttpPost]
public ActionResult Sum(CalculatorModel model)
{
model.Result = model.FirstOperand + model.SecondOperand;
//Return the result
return View(model);
}
}
Run Code Online (Sandbox Code Playgroud)
@model HTMLHelpersDemo.Models.CalculatorModel
@{
ViewBag.Title = "Sum";
}
<h2>Sum</h2>
@using (Html.BeginForm("Sum", "Calculator", FormMethod.Post))
{ …
Run Code Online (Sandbox Code Playgroud) c# ×8
.net ×3
asp.net ×3
javascript ×2
linq ×2
validation ×2
asp.net-core ×1
asp.net-mvc ×1
oop ×1
regex ×1
windows ×1
winforms ×1