Tag: asp.net

EntityFramework包版本=“6.1.3”和Web配置版本6.0.0.0?

我创建了一个包含EF 6.1.3的ASP.NET项目 它的show package version =“6.1.3”和Web.config版本6.0.0.0 但是在web.config中我仍然有这个: section name=”entityFramework” type=”System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ requirePermission=”false” 所有其他依赖程序集都已正确更新。 它在服务器上出错 名称空间’System.Data.Entity中不存在类型或命名空间名称“Infrastructure” 我认为这是由于版本问题。 我应该自己更新吗?

查找嵌套在Repeater Control中的控件

我试图找到通过 UserControl在Repeater中呈现的TextBoxes的值,即Repeater有UserControl的占位符,而UserControl内部是TextBox标记实际存在的位置。 我以前用直接在 Repeater 里面的TextBoxes做过这个,这是相当直接的,我想知道为什么这显然不能以同样的方式完成。 这是带有Repeater的Default页面,其中包含一个Placeholder … Faculty Information …以及插入Placeholder位置的UserControl … Faculty Salary Form …但是当以下代码运行Display按钮的OnClick时,我总是得到UserControl中任何和所有TextBoxes(和DropDowns)的空值… protected void DisplayEntries(object sender, EventArgs e) { foreach (RepeaterItem repeated in rptBudget.Items) { TextBox txtPercentage = (TextBox)repeated.FindControl(“txtPercentage”); if (txtPercentage == null) { lblCtrls.Text += ” null; “; } else { lblCtrls.Text += txtPercentage.Text + “; “; } } } 访问这些值的最佳方法是什么? […]

链接文本框控件的必填字段和正则表达式validation器的问题

我正在尝试使用ASP.net实现表单validation,我已经尝试了这里建议的每个解决方案,但最好的是迄今为止在aspsnippets.com上 。 我的代码如下: 使用Javascript function WebForm_OnSubmit() { if (typeof (ValidatorOnSubmit) == “function” && ValidatorOnSubmit() == false) { for (var i in Page_Validators) { try { var control = document.getElementById(Page_Validators[i].controltovalidate); if (!Page_Validators[i].isvalid) { control.className = “error”; } else { control.className = “”; } } catch (e) { } } return false; } return true; } function […]

尝试使用aspnet_compiler从命令行构建和发布Asp.net网站

我正在尝试这个。 我已经建立了asp.net网站。 当我通过VS2008发布到IIS时,它工作正常。 让我说我的网站是在c:\ projects \ Website1 \我想将它发布到c:\ Inetpub \ wwwroot \ WebsiteOne 我试图模仿出版工作室的出版物。 那就是发布并删除任何内容。 我试过这个:aspnet_compiler -v / WebsiteOne -fc:\ Inetpub \ wwwroot \ WebsiteOne 错误:错误ASPRUNTIME:预编译目标目录(c:\ Inetpub \ wwwroot \ WebsiteOne)不能与源应用程序目录(c:\ inetpub \ wwwroot \ WebsiteOne)位于同一树中。 当我尝试这个:aspnet_compiler -v / WebsiteOne 我收到错误此应用程序已经预编译。 任何能够让我了解如何编译线构建和发布网站的人 谢谢

Request.Files始终为null

我正在编写一个C#ASP.Net MVC应用程序,以便客户端将文件发布到其他服务器。 我正在使用通用处理程序来处理从客户端到服务器的已发布文件。 但是在我的处理程序中,System.Web.HttpContext.Current.Request.Files总是为空(0计数)。 表格代码: @model ITDB102.Models.UploadFileResultsModels @{ Layout = “~/Views/Shared/_Layout.cshtml”; } Upload File Send File @section scripts{ // Variable to store your files var files; var form = document.getElementById(‘file-form’); // Add events $(‘input[type=file]’).on(‘change’, prepareUpload); // Grab the files and set them to our variable function prepareUpload(event) { files = $(‘#FilePath’).get(0).files; } form.onsubmit = function […]

ASP GridView在按钮单击时获取行值

我在做什么 – 在图像按钮上单击重置用户密码。 完成到目前为止 – 添加了GridViewCommandEventHandler – 它正确触发。 使用MSDN中的代码。 我为我的e.CommandArgument得到一个空字符串(“”),它在运行时抛出一个错误(无法解析“”到int)。 我可以在调试器中看到在e的其他地方存储了一个’rowIndex’属性(正确用于我的点击),我可以访问它吗? 我认为MSDN的代码可以正常工作 – 是否还有其他一些方法可以解决这个错误或其他方法来修复它? 谢谢。 void resetpassword(Object sender, GridViewCommandEventArgs e) { // If multiple ButtonField columns are used, use the // CommandName property to determine which button was clicked. if (e.CommandName == “resetpass”) { // Convert the row index stored in the CommandArgument // property […]

WCF服务返回400 Bad Request

我有这个应用程序在本地和部署时使用.mdf SQL Express数据库文件(我通常用于测试目的)。 但是,当我将其更改为与我们的SQL Server 2008一起使用时,应用程序可以正常工作,但服务却没有。 例如,如果在我的代码页面后面我有一个按钮,将数据添加到这样的表,它可以正常工作: public static string connString = @”Data Source=server1;Initial Catalog=Project;Integrated Security=True”; protected void btnAddProj_Click(object sender, EventArgs e) { using (var sqlc = new SqlConnection(connString)) { sqlc.Open(); var cmd = sqlc.CreateCommand(); int intProjectID; // Add the project info to the database cmd.CommandText = “INSERT INTO tblProject VALUES(@ProjName,@ProjTeam,@ProjStart,@ProjEnd)”; cmd.Parameters.Add(“ProjName”, System.Data.SqlDbType.NVarChar).Value = txtProjName.Text; […]

.ASPX上的自定义用户控件和友好属性项集合(如ListBox和ListItems,但列表)

我一直想知道如何为用户控件执行公共属性,其工作方式类似于.NET native Item的集合属性(例如,ListBox和ListItems): <- Inline item collection… 我一直在网上查看,但没有任何成功。 我认为它必须是我需要添加到属性的任何类型的属性,OR接口应该需要由用户控件inheritance,但是没有关于它的线索,并且一直在考虑它。 我必须在自定义用户控件上工作,但Visual Studio没有将其识别为有效的项集合。 假设我们有这个userControl: public partial class userControls_Blablabla : System.Web.UI.UserControl { public List ConfigItem {get; set; } blablabla…rest logic here… } public class configItem { public string Name {get; set;} public string Url {get; set;} public string Color {get; set;} blablabla…rest logic here… } 应该如何做,能够在Visual Studio的.ASPX编辑器上做类似的事情,并得到Intellisense的识别? 对不起我的英语,我知道这不是很好。 […]

添加自定义请求标头适用于IIS 7.0但不适用于Asp.net开发服务器

我们正在跟踪请求响应所需的总时间。 我们使用global.asax.cs的Application_AcquireRequestState中的请求的唯一键实现了添加的自定义头: request.headers.add(“reqKey”,key) 。 当针对该请求命中Application_PostRequestHandlerExecute时,它会将带有唯一键的自定义标头拉回,并使用该记录记录总响应时间。 还记录了许多其他内容,例如用户名,表单数据等,而不仅仅是简单的计时。 当代码在IIS 7.5上运行时,这当前工作正常。 但是,当它在ASP.Net开发服务器上运行时,它会抛出Operation is not supported on this platformexceptionOperation is not supported on this platform的Operation is not supported on this platform 。 我们的产品是IIS 7,那么我该如何解决这个错误呢?

将按钮作为网格视图中的最后一列放置

我有一个网格视图,我通过代码添加列: //Retrieve “Table” from database gridOffers.DataSource = table; gridOffers.DataBind(); 按代码添加的列是在按钮之后添加的,这不是我需要的: 如何确保添加到购物车按钮的最后一件事? gridView的来源: