我最近在visualstudio.com上创建了项目,并在azure上启用了连续构建.我创建了web api项目,并创建了一些模型和api控制器.然后我在网上进行了部署,很长一段时间都很酷.然后我通过NuGet更新了所有依赖项.Build在本地运行良好,也在我的本地机器上运行app.然后我检查了tfs,自动部署踢了,生成错误.它说:
C:\a\src\HitchStopApi\packages\Microsoft.Bcl.Build.1.0.6\tools\Microsoft.Bcl.Build.targets (74): The "EnsureBindingRedirects" task could not be loaded from the assembly C:\a\src\HitchStopApi\packages\Microsoft.Bcl.Build.1.0.6\tools\Microsoft.Bcl.Build.Tasks.dll. Could not load file or assembly 'file:///C:\a\src\HitchStopApi\packages\Microsoft.Bcl.Build.1.0.6\tools\Microsoft.Bcl.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
在我的本地机器构建中,我收到了测试项目的警告
D:\Programming\Projects\HitchStop\HitchStopApi\packages\Microsoft.Bcl.Build.1.0.6\tools\Microsoft.Bcl.Build.targets(220,5): warning : Project must install nuget package Microsoft.Bcl.
在本地我使用.NET 4.5,MVC4,实体框架5.0 ...
好的,这很烦人,而且可能非常简单.我想启动带有禁用复选框的网页,并在选中列表框中的细分行后启用这些框.所以我把它放在onload方法中
onload = function () {
for (i = 0; i < document.frmMain.checkgroup.length; i++){
document.frmMain.checkgroup[i].disabled = true ;
}
}
Run Code Online (Sandbox Code Playgroud)
它启动我的页面与禁用框,现在我想要启用它们
function enableCheckboxes(){
if (document.frmMain.Vrste[document.frmMain.Vrste.selectedIndex].value == "Sendvici i Rostilj"){
for(i=0;i<document.frmMain.checkgroup.length;i++){
document.frmMain.checkgroup[i].enabled = true;
}
}
}
Run Code Online (Sandbox Code Playgroud)
它进入for循环,但它永远不会启用那些复选框.我无法理解为什么.
这是html部分,我调用enablecheckbox函数:
<select name="Vrste" onChange="PopulatePodvrste(); enableCheckboxes();" size="8">
<option value="Pica">Pica</option>
<option value="Barbarina domaca trpeza">Barbarina domaca trpeza</option>
<option value="Slana Palacinka">Slana Palacinka</option>
<option value="Slatka Palacinka">Slatka Palacinka</option>
<option value="Sendvici i Rostilj">Rostilj i sendvici</option>
<option value="Dobro jutro sa Barbarom">Dobro jutro sa Barbarom</option>
<option value="Chicken Meni">Chicken Meni</option>
<option value="Posebna Ponuda">Posebna …Run Code Online (Sandbox Code Playgroud) 我想从表Account中选择多个(所有)值.
string query = "SELECT * FROM Account";
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand(query, connection);
SqlDataReader reader;
connection.Open();
reader = command.ExecuteReader();
reader.Read();
label1.Text = reader["PasswordHash"].ToString();
connection.Close();
Run Code Online (Sandbox Code Playgroud)
为什么这总是只返回第一行.实际上它返回一行,因为如果我在where子句中设置类似的where id = 2 and id = 3东西仍然只返回一个值.从Management Studio检查表有多个值,查询运行应该如此.
提前致谢.
这很令人沮丧,我想在点击时在我的页面上创建新的input field内部.我使用javascript函数将新的子元素(输入字段)附加到现有的.这一切看起来像这样:divaspxbuttondiv
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="Pages_test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function clone() {
var html = document.createElement("input");
html.setAttribute("id", 1);
html.setAttribute("name", "dejan");
html.setAttribute("value", "some text");
html.setAttribute("type", "text");
document.getElementById("panj").appendChild(html);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="panj">
Djubrov
</div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="clone()" />
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
有趣的是,当我点击按钮时,带有设置文本值的文本元素闪烁第二,但它在消息后消失.我错过了什么吗?
嗯,我遇到了一个奇怪的问题。当我创建类的新实例时,我得到StackOverflowExcepion :)
这是代码:
public partial class PlayerChooser : Window
{
public PlayerChooser()
{
InitializeComponent();
textBoxPlayer1Name.Visibility = Visibility.Hidden;
textBoxPlayer2Name.Visibility = Visibility.Hidden;
textBoxPlayer3Name.Visibility = Visibility.Hidden;
textBoxPlayer4Name.Visibility = Visibility.Hidden;
}
public static String player1Name;
public static String player2Name;
public static String player3Name;
public static String player4Name;
...
PlayerChooser.player1Name = textBoxPlayer1Name.Text;
PlayerChooser.player2Name = textBoxPlayer2Name.Text;
TwoPlayers501_new twoPlayers501_new = new TwoPlayers501_new();
twoPlayers501_new.Show();
...
}
Run Code Online (Sandbox Code Playgroud)
以及发生异常的类和构造函数
public partial class TwoPlayers501_new : Window
{
public TwoPlayers501_new()
{
InitializeComponent();
textBlockPlayer1Name.Text = PlayerChooser.player1Name;
textBlockPlayer2Name.Text = PlayerChooser.player2Name;
}
...
}
Run Code Online (Sandbox Code Playgroud)
预先感谢,这可能有点琐碎...
我最近在矿山生产机器上安装了Visual Studio 11 Beta和.Net Framework 4.5(但是并排放置了Visual Studio 2010).它对我来说好几天,但后来开始投入InvalidOperationException这段代码:
ItemDB itemDB = new ItemDB();
ItemDetails item = itemDB.GetItem((int)Session["itemId"]);
string code = item.Code;
Control html = ParseControl(code);
placeholderPage.Controls.Add(html);
Run Code Online (Sandbox Code Playgroud)
异常发生在我的行中ParseControl,在字符串代码中我有常规的html.最奇怪的是,在我安装新的Visual Studio之前,这段代码工作得很好,它仍适用于在.NET Framework 4上安装VS2010的大学机器.
异常后,它显示了这条消息: Cannot instantiate type 'TracedLiteralControl' because there is no public parameterless constructor.