好的,所以,我来自ASP编程世界 - ASP.NET有点新,我使用的是Visual Studio 2013.
所以,当我只是尝试构建一个简单的表单时,我收到此错误消息:
Server Error in '/' Application.
Stack empty.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Stack empty.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack …Run Code Online (Sandbox Code Playgroud) 我有一个VB.NET WebForms应用程序,我试图在标记中使用内联服务器标签来调用位于模块中的函数.无论我做什么,当我使用<%= %>或<%# %>标记时,我都无法使用intellisense来显示方法.这是我的模块:
Module TestModule
Function test() As String
Return String.Empty
End Function
End Module
Run Code Online (Sandbox Code Playgroud)
但是,当我将模块转换为类并将方法转换为共享方法时,我可以这样做:
Public Class TestClass
Shared Function test() As String
Return String.Empty
End Function
End Class
Run Code Online (Sandbox Code Playgroud)
我可以把它放在我的表格中:
<%= MyApp.TestClass.test%>
Run Code Online (Sandbox Code Playgroud)
我可以在控件绑定中使用它:
<asp:Button ID="cmWhatever" Text='<%#MyApp.TestClass.test%>' runat="server" />
Run Code Online (Sandbox Code Playgroud)
如何从标记中引用模块方法?
我拥有的Webforms应用程序非常重要,它主要是ASP控件执行ADO.net操作.我有5-15秒的加载时间,这是正常的,但我想让用户更清楚他们的请求正在被处理.
我想要做的是添加一个加载图像或某种可视元素,它将在服务器代码运行时显示.
ASP:
<telerik:RadButton ID="OKbutton" runat="server"
Skin="WebBlue"
Text="OK">
</telerik:RadButton>
Run Code Online (Sandbox Code Playgroud)
C#:
private SqlDataReader dr = null;
protected void OKbutton_Click(object sender, EventArgs e)
{
//Long running query
string query = "UPDATE Employees SET Salary = 12345 WHERE EmployeeID = 123"
SqlCommand cmd = new SqlCommand(query, db.DbConnection);
dr = cmd.ExecuteReader();
}
Run Code Online (Sandbox Code Playgroud) 我的页面上有一个jquery UI对话框.它只包含一个asp FileUpload控件:
<asp:FileUpload runat="server" ID="fuAttachment" />
Run Code Online (Sandbox Code Playgroud)
对话框有1个按钮"OK".那些按钮只是关闭对话框
$("#attachment-dialog").dialog({
height: 300,
width: 400,
modal: true,
resizable: false,
autoOpen: false,
buttons: {
"OK": function () {
$(this).dialog("close");
}
}
});
Run Code Online (Sandbox Code Playgroud)
按下我页面上的保存按钮.这是一个asp.net按钮,调用SaveAttachement方法.
问题是fuAttachment.HasFile(fileupload控件)一直返回false.如果我将fileupload控件移到jQuery UI对话框之外.HasFile = true.
但控件应该在对话框内.特定页面内没有更新面板.
将我的asp.net webform网站从Owin 2.1.0升级到Owin 3.0.1之后,我有前面提到的编译错误......我正在尝试使用SignalR 2和CORS.这是我的packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="jQuery" version="2.1.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR" version="2.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.Core" version="2.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.JS" version="2.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.2.0" targetFramework="net45" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Cors" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
</packages>
Run Code Online (Sandbox Code Playgroud)
我的OwinStartup类在appsettings中的web.config中定义如下:
<add key="owin:AppStartup" value="SignalRStartup, App_Code" />
Run Code Online (Sandbox Code Playgroud)
这就是班级的样子:
using System;
using …Run Code Online (Sandbox Code Playgroud) 在DIV中显示PDF文件的最佳方法是什么.
我需要将生成的PDF显示到jquery Accordian选项卡的一个选项卡中.
任何人都可以指导什么是最好的移动方式.
我试图将数据从webform传递给代码隐藏方法并在webform中获取值,然后打印它.我最初测试以下代码只是简单地发布请求到方法,获取字符串并在页面中打印并且它有效,但在尝试将数据发布回方法时出现问题
$(document).ready(function () {
$(".AddStaffToRoleLink").on("click", function () {
var selectedStaffID = $(this).attr("id");
alert("this is " + selectedStaffID);
$.ajax({
type: "POST",
url: "AddUserInRole.aspx/AddRoleForSelectStaff",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: { selectedStaffID: selectedStaffID },
success: function (response) {
$("#Content").text(response.d);
},
failure: function (response) {
alert(response.d);
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
[WebMethod]
public static string AddRoleForSelectStaff(string selectedStaffID)
{
return "This string is from Code behind " + selectedStaffID;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用ASP.NET 3.5 App.我有$ ajax jQuery函数调用代码隐藏方法与发送人员ID.
我希望Response.Redirect从此方法打开但是会出现以下错误
$.ajax({
url: 'AddUserInRole.aspx/GetRolesListFilteredByStaff_NotIn',
type: "POST",
data: JSON.stringify({ GivenStaffID: selectStaffIDToAddRole }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert(response.d);
},
failure: function (response) {
alert(response.d);
}
}).done(function (response) {
//
});
Run Code Online (Sandbox Code Playgroud)
[WebMethod]
private static void GetRolesListFilteredByStaff_NotIn(string GivenStaffID)
{
Response.Redirect("/SelectRoleForStaff.aspx?staffID='GivenStaffID'");
}
Run Code Online (Sandbox Code Playgroud)
我的第二个问题是如何在新的上传页面中从url读取staffID
我已设法调用require方法,但它没有重定向页面...
[WebMethod]
public static void GetRolesListFilteredByStaff_NotIn(string GivenStaffID)
{
HttpContext.Current.Response.Redirect("/SelectRoleForStaff.aspx?staffID="+GivenStaffID);
}
Run Code Online (Sandbox Code Playgroud) 如何从.cs文件访问母版页属性?我尝试了下面的代码,但我无法访问它.请让我知道.
public int TypeID
{
get
{
return Convert.ToInt32(this.ViewState["TypeID"]);
}
set
{
this.ViewState.Remove("TypeID");
this.ViewState.Add("TypeID", value);
}
}
Run Code Online (Sandbox Code Playgroud)
var pageHandler = HttpContext.Current.CurrentHandler;
if (pageHandler is System.Web.UI.Page)
{
typeId = Convert.ToInt32((System.Web.UI.Page)pageHandler).Master.TypeID;
}
Run Code Online (Sandbox Code Playgroud) webforms ×10
asp.net ×8
c# ×5
asp.net-3.5 ×2
jquery ×2
ajax ×1
cors ×1
html ×1
jquery-ajaxq ×1
jquery-ui ×1
master-pages ×1
owin ×1
pdf ×1
signalr ×1
vb.net ×1