我刚刚在VS2013中打开了一个网站,当我运行调试器时,我收到了Javascript异常:
Unhandled exception at line 194, column 21 in http://localhost:49809/
0x800a1391 - JavaScript runtime error: '$' is undefined
Run Code Online (Sandbox Code Playgroud)
这是代码:
<script type="text/javascript">
$(function () {
$('#one').ContentSlider({
width: '960px',
height: '250px',
speed: 400,
easing: 'easeOutSine'
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
单击继续,我得到另一个例外:
Unhandled exception at line 37, column 59140 in http://localhost:52306/27fadf043d464a019907842c2a5a764e/browserLink
0x800a139e - JavaScript runtime error: Syntax error, unrecognized expression: unsupported pseudo: plusone
Run Code Online (Sandbox Code Playgroud)
在VS2012中,该网站可以正常运行和调试.我怀疑它与引用远程Javascript块(<script src="//code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>和<script type="text/javascript" src="//apis.google.com/js/plusone.js">)有关.我需要修改权限设置吗?
任何帮助将不胜感激.
麻木
我还有另一个相关问题没有答案:我的stackoverflow问题
但是,如果我设置,我的问题就会消失EnableEventValidation="false".
现在我的问题是,如果我设置它,它会成为一个非常大的问题MasterPage吗?
在所有参考设置中false,没有人提出除MSDN之外的安全问题.
有什么建议?
我已经完全掌握了Web用户控件和更改<div>父ASPX中的可见性.
我有一个位于用户控件内的购物车,其中一个页面包含了UC,其状态<div>显示了购物车内容的摘要.如果购物车是空的,则表示不同<div>.
UC中的代码
if (varCartStatus)
{
cartStatusTrue.Visible = true;
cartStatusFalse.Visible = false;
else
{
cartStatusTrue.Visible = false;
cartStatusFalse.Visible = true;
}
Run Code Online (Sandbox Code Playgroud)
我目前得到的是当前上下文中不存在'cartStatusTrue'.'cartStatusFalse'在当前上下文中不存在.
如何让UC改变<div>父ASPX中的可见性?
对不起,我对.net和C#很新,我完全迷失了(再次!)
如何在页面后面的相同代码上从另一个方法调用以下方法?
protected void CustomValidatorDelLN_ServerValidate(object sender, ServerValidateEventArgs args)
{
bool is_valid = txtDeliveryLastName.Text != "";
txtDeliveryLastName.BackColor = is_valid ? System.Drawing.Color.White : System.Drawing.Color.LightPink;
args.IsValid = is_valid;
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何处理这个(object sender, ServerValidateEventArgs args)位.我打电话CustomValidatorDelLN_ServerValidate();给括号里面放什么?
我使用VS2012创建了一个简单的Windows窗体应用程序,我正在尝试将其安装到XP机器上.
不幸的是我收到以下错误消息:
setup.exe不是有效的Win32应用程序.
不可否认,我确实使用了.net 4.5框架,这是XP机器上的一个问题.但我现在使用.net 2.0创建了一个测试应用程序,并得到了同样的问题.
我正在开发一个Win7的X64机器上的应用程序,并试图平台任何喜悦设置为86在配置管理器.
这是我还是VS 2012?我已经设法使用VS2010安装测试应用程序?
当我尝试使用VS2012处理Lightswitch应用程序并放弃它时,我遇到了类似的问题.
有什么建议?
干杯,麻木
考虑以下代码:
var items = (new[] {
new {itemTypeId = 1 , cost=100 },
new {itemTypeId = 2 , cost=200 },
new {itemTypeId = 1 , cost=50 },
new {itemTypeId = 3 , cost=150 },
new {itemTypeId = 1 , cost=75 }
});
var o = items.OrderBy(x => x.cost)
.ToList()
.GroupBy(x => x.itemTypeId )
.Select(g => new { g, count = g.Count() })
.SelectMany(t => t.g.Select(b => b).Zip(Enumerable.Range(1, t.count), (j, i) => new { j.itemTypeId , j.cost }));
foreach (var i …Run Code Online (Sandbox Code Playgroud) 我正在学习C#并在我的第一个ASP.Net电子商务网站上工作.
我有以下转发器:
<asp:Repeater ID="Cartridges" runat="server" OnItemCommand="Cartridges_ItemCommand">
<ItemTemplate>
<asp:LinkButton ID="buy" runat="server" CommandName="AddtoCart" CommandArgument=<%#Eval("cartID") %> Text="Buy"></asp:LinkButton>
</ItemTemplate>
Run Code Online (Sandbox Code Playgroud)
但是,当呈现代码时,转发器会生成JavaScript以进行回发,如果用户关闭了JavaScript,则填充购物车时效果不佳!
<div class="wrap-cart">
<div class="cartbuy"><a id="ContentPlaceHolder1_Cartridges_buy_0" href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$Cartridges$ctl00$buy','')">Buy</a></div>
<div class="cartimg"><a href="url.html" class="productsurl"><img src="pic/epson-comp-set50.jpg" alt="product" /></a></div>
<div class="carttext">
<p class="cartdesc"><a href="url.html" class="productsurl"><span class="homeprinters">product</span></a></p>
<p class="cartprice">£x.xx</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我想要做的就是将cartID传递给数据表.有没有办法围绕它,所以JavaScript根本没有涉及?
为了完整性,我的代码背后是:
protected void Cartridges_ItemCommand(object source, RepeaterCommandEventArgs e)
{
cartidtest.Text = "added";
if (e.CommandName == "AddtoCart")
{
string varCartID = (e.CommandArgument).ToString();
//more code here
}
}
Run Code Online (Sandbox Code Playgroud) 我试图创建一个asp:DropDownList的子类,所以我可以使用asp:DdlNoEventValidation.这样我就可以规避事件验证.
这是页面指令
<%@ Register TagPrefix="asp" Namespace="System.Web.UI.WebControls" Assembly="NoValidationDropDownList" %>
Run Code Online (Sandbox Code Playgroud)
这里是应该继承DropDownList的类(它是一个独立的.cs文件,位于App_Code)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
namespace System.Web.UI.WebControls
{
public class DdlNoEventValidation : System.Web.UI.WebControls.DropDownList
{
}
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误
警告1元素'DdlNoEventValidation'不是已知元素.如果网站中存在编译错误,或者缺少web.config文件,则会发生这种情况.
错误2无法加载文件或程序集"NoValidationDropDownList"或其依赖项之一.该系统找不到指定的文件.
错误3未知服务器标记'asp:DdlNoEventValidation'.
这应该是简单的,我显然做了一些非常错误的事情,尽管在这里和其他互联网上搜索答案.这让我疯了,请帮忙!
上一个错误发生在列表框上的SelectedIndexChanged单击事件上.
在调试中返回的值是"",但是当你查看网页源代码时肯定有值.
这是我的列表框:
<asp:ListBox ID="lstBxMyList" runat="server" CssClass="binorderlst1"
DataTextField="myName"
DataValueField="myID"
OnSelectedIndexChanged ="lstBxMyList_SelectedIndexChanged"
AutoPostBack="true" Rows="10">
</asp:ListBox>
Run Code Online (Sandbox Code Playgroud)
这是活动:
protected void lstBxMyList_SelectedIndexChanged(object sender, EventArgs e)
{
myID = Convert.ToInt32(lstBxSiteList.SelectedValue.ToString());
... rest of code
}
Run Code Online (Sandbox Code Playgroud)
为了完整性,这里是数据绑定:
private void BindLstBxMyList(int myOtherID)
{
DataTable dt = new DataTable();
SqlConnection conn;
SqlCommand comm;
using (conn = new SqlConnection(aSHconns.aconn))
{
comm = new SqlCommand("myStoredProc", conn);
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.Add(new SqlParameter("@myOtherID", SqlDbType.Int));
comm.Parameters["@myOtherID"].Value = myOtherID;
SqlDataAdapter sqlDa = new SqlDataAdapter(comm);
try
{
conn.Open();
sqlDa.Fill(dt);
if (dt.Rows.Count > 0)
{
lstBxMyList.DataSource …Run Code Online (Sandbox Code Playgroud) 我对LINQ很新,我最初使用它的一个尝试必须超级复杂!
我试图在这个Stack Over问题中调整已接受的答案.
我这样写了:
using (var ctx = new MyEntities())
{
var q = ctx.tblPrices.OrderByDescending(x => x.Cost)
.GroupBy(x => x.ItemID)
.Select(g => new {g, count = g.Count()})
.SelectMany(t => t.g.Select(b => b).Zip(Enumerable.Range(1, t.count), (j, i) => new {j.WebPrice, j.PriceID, j.ItemID}));
foreach (var i in q)
{
sb.AppendFormat("Id = {0}, Name = {1}, ItemId = {2}<hr/>", i.WebPrice, i.PriceID, i.ItemID);
}
}
Run Code Online (Sandbox Code Playgroud)
基本上,我想从不同供应商那里退回相同商品的最便宜价格.
但是,当我运行项目时,我得到以下很长的错误消息,我不知道它意味着什么.但它看起来很严重!
LINQ to Entities无法识别方法'System.Collections.Generic.IEnumerable
1[<>f__AnonymousType53 [System.Nullable1[System.Decimal], System.Int32,System.Int32]] Zip[tblPrice,Int32,<>f__AnonymousType53](System.Collections.Generic.IEnumerable1[MyProjectMVC.Models.tblPrice], System.Collections.Generic.IEnumerable1 [System.Int32],System.Func3[MyProjectMVC.Models.tblPrice,System.Int32, <>f__AnonymousType5 …
c# ×8
asp.net ×5
javascript ×2
linq ×2
.net ×1
asp.net-mvc ×1
bootstrapper ×1
exception ×1
jquery ×1
listbox ×1
publish ×1
repeater ×1
winforms ×1