【c# – KnockoutMVC提交按钮不起作用】教程文章相关的互联网学习教程文章

c# – ASP.NET核心 – 自定义AspNetCore.Identity实现不起作用【代码】

我正在构建一个完全自定义的AspNetCore.Identity实现,因为我希望TKey全面成为System.Guid.尊敬的我,我已经派出类型…… >角色:IdentityRole< Guid,UserRole,RoleClaim>> RoleClaim:IdentityRoleClaim< Guid>>用户:IdentityUser< Guid,UserClaim,UserRole,UserLogin>> UserClaim:IdentityUserClaim< Guid>> UserLogin:IdentityUserLogin< Guid>> UserRole:IdentityUserRole< Guid>> UserToken:IdentityUserToken< Guid> > Ap...

c# – Insert-Statement不起作用 – 没有错误消息【代码】

我是这个网站的新手,但我希望你们中的一些人可以通过解决我的问题来帮助我:) 我想通过insert语句在sql-database中保存数据,我已经以相同的方式为另一个表创建了它,它运行良好.Visual Web Developer不报告错误消息,但插入不插入数据. 这是我的一些代码:public void saveAnswers() {//hier erfolgt das Speichern der Fragen/Antworten in die DBList<Question> questionlist = (List<Question>)HttpContext.Current.Session["quest...

c# – 在WebBrowser控件上显示PDF不起作用【代码】

我有一个test.pdf,我想在我的表单中显示它. 我的代码非常简单:public Form1(){InitializeComponent();this.wbPdf.Navigate(@"file:///<fullpath>\test.pdf#toolbar=0");}它不起作用.它显示了一个带有“X”的白页. 但如果我这样做:this.wbPdf.Navigate(@"file:///<fullpath>\test.pdf#toolbar=0", true);IE打开了,它显示了我的pdf.当然,我试图在第二个参数中使用false,但它不起作用. 此外,如果我尝试做类似的事情this.wbPdf.Navig...

c# – 为什么ArrayList的同步包装器不起作用?【代码】

我已经使用“添加Web引用”在Visual Studio中为Web服务生成了代理类.生成的RTWebService类有一个方法SetValueAsync.我扩展了这个类并添加了一个SetValueRequest,它跟踪请求并在发生错误时取消所有挂起的请求.对于每个请求,我将userState对象存储在我创建的ArrayList中,如下所示:requests = ArrayList.Synchronized(new ArrayList());我创建了一个方法:public void CancelPendingRequests() {lock (requests.SyncRoot) {if (reque...

使用C#从IntPtr复制字节数组与Marshal.Copy不起作用【代码】

我正在使用一个非托管库,它可以生成灰度图像(大约100200像素,或多或少).图像包含在结构中,在C中如下所示:typedef struct abs_image {ABS_DWORD Width;ABS_DWORD Height;ABS_DWORD ColorCount;ABS_DWORD HorizontalDPI;ABS_DWORD VerticalDPI;ABS_BYTE ImageData[ABS_VARLEN]; } ABS_IMAGEtypedef unsigned int ABS_DWORD; typedef unsigned char ABS_BYTE;在这里我的C#包装器结构:[StructLayout(LayoutKind.Sequential, ...

c# – Combobox.Visible属性不起作用【代码】

晚上,我在静态类中有以下代码,这有助于我的userInterface分部类.每当我到达检查组合框/文本框是否可见的部分时:if (cb.Visible == true)&安培;if (tb.Visible == true)即使控件在表单上可见,它也总是假的. 有任何想法吗? 谢谢public static bool VerifyTableLayoutControlsContainData(TableLayoutPanel tlp){foreach (Control input in tlp.Controls){ComboBox cb = input as ComboBox;if(cb != null){if (cb.Visible == true){...

c# – moq返回不起作用【代码】

我试着让我的简单模拟工作,但它太繁琐了.我在这个地方犯了一个错误 (string s1,string s2)=> {return(string)(s1 s2); }); 消息说明了这一点“Delegate ‘System.Func’ does not take 2 arguments” 但在this文章中都有效 这里的所有代码.public interface IWriteTwoString {string WriteTwoStrings(string s1, string s2); }public MyPriceReducerTest() {Mock<IWriteTwoString> writeMock = new Mock<IWriteTwoString>(MockBeha...

c# – 从代码隐藏调用的Javascript警报框不起作用【代码】

我需要警告框让用户知道成功输入或数据冲突.我尝试了以下内容,没有错误,也没有警报. 在Save_Click中:ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: UpdateComplete(); ", true);也…ClientScript.RegisterClientScriptBlock(GetType(), "Javascript","<script>alert('Record Added Successfully')</script>");也…Save.Attributes.Add("onclick","return ReqField1Validator()");我已经使用了GetTyp...

在c#中将键击发送到应用程序(sendkeys,postmessage,sendmessage都不起作用)【代码】

我正在尝试执行以下操作之一 1.打开所需程序并以编程方式按键 2.找到程序的打开窗口并以编程方式按键 (要么很好) 我尝试了很多SendKeys.SendWait(),PostMessage()和SendMessage()的实现失败.以下是我的代码片段//included all these for attempts [DllImport("User32.dll")] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("User32.dll")] static extern int SetForegroundWindow(IntPtr...

c# – (obj!= null)不起作用【代码】

它接缝简单,但我真的不明白.我正在使用linq和Entity Framework通过这样的简单查询从数据库中检索对象loggedinUser = (from user in context.Userswhere user == _guidselect user).ToList()[0];我知道我可以使用.FirstOrDefault(),但我不认为我的问题与我获取用户的方式有关. 获得用户后如果我检查这个条件if (loggedinUser != null){ToLocation = String.Format("{0} {1} {2} {3}", loggedinUser.StreetAddress,loggedinUser.City...

c# – 为什么我的委托作为参数传入方法时不起作用?【代码】

我创建了一个委托,我想使用委托作为方法参数列表中的参数.我想要像在Main方法中那样完美地调用处理程序. 问题:如何将委托传递给方法? 码:using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace ConsoleApplication1 {class Program{public delegate void Del(string e);Del handler = DelegateMethod;public static void DelegateMethod(string message){System.Console.WriteLine(...

c# – VS2013代码分析自定义词典不起作用【代码】

我正在尝试使用visual studio的代码分析功能.不幸的是(或幸运的是?),我住在加拿大,代码分析抱怨我的拼写“颜色”这个词.我试图使用custom dictionary,但VS2013似乎忽略了它. 这是字典相对于项目(和解决方案)的位置: 这是字典文件的内容:<Dictionary><Words><Unrecognized><Word></Word></Unrecognized><Recognized><Word>colour</Word></Recognized><Deprecated><Term PreferredAlternate=""></Term></Deprecated><Compound><Te...

c# – 继承自AuthorizeAttribute的属性不起作用【代码】

我目前正在尝试基于用户角色在新的ASP MVC 5应用程序中实现安全性.目标是防止用户访问某些控制器或控制器方法,如果他们没有某个角色(或更高).基于我到目前为止所读到的问题,我创建了一个继承AuthorizeAttribute的属性,它看起来像这样(MyAppRole是枚举,顺便说一句):[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public sealed class AuthorizeRoleOrSuperiorAtt...

c# – 如果jquery中的语句不起作用【代码】

alert(x)是假的.但由于某种原因,它不会进入if语句?有任何想法吗? HTML@{bool x = false;foreach (var c in Model.Cleaner.TimeConfirmations.Where(l => l.date.ToShortDateString() == DateTime.Now.ToShortDateString() || l.date.ToShortDateString() == DateTime.Now.AddDays(1).ToShortDateString())){x = true;}<span class="ifAvailable" data-confirmationchecker="@x" value="15">@x</span>}jQuery的var x = $(".ifAvai...

ConnectString在C#中不起作用【代码】

public static DataSet ParseDatabaseData(string sheetName) {string connectionString = "Provider=System.Data.SqlClient;Data Source= MHSPC56888_VM1\\SQLEXPRESS;Initial Catalog=xxxxxxx;User id=xx;Password=xxxxx;"; SqlConnection conn = new SqlConnection(connectionString);string strSQL = "SELECT * FROM [" + sheetName + "$]";SqlCommand cmd = new SqlCommand(strSQL, conn);conn.Open();DataSet dataset = new ...