- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 ASP.NET 3.5 中工作,使用 VB.NET 作为我的服务器端语言。我通过 jQuery 1.5.2 使用 JavaScript 作为我的客户端语言。我正在尝试使用此页面进行原型(prototype)/命名空间设置。此页面是使用 MultiView 的自定义登录页面。我有一个策略登录 View 和一个忘记密码 View 。我将 ActiveViewIndex 存储在名为 currentView
的隐藏字段中。
我在这个项目中使用部分回发和 UpdatePanel,并且 JS 没有在部分回发上刷新。
就是说,我需要一种方法来等待 ActiveViewIndex 在服务器端发生更改,以便我可以调用相应 View 的 init()
函数。这可能吗?
我的客户端代码:
var page =
{
currentView : getContentElement( "currentView" ),
init : function ()
{
log( "initializing page" );
if ( this.currentView === "forgotpassword" ) { forgotPassword.init(); }
else { policyLogon.init(); }
}
};
page.init();
var policyLogon =
{
panel : getContentElement( "pnlLogonInfo", "div" ),
submitButton : getContentElement( "btnLogon", this.panel ),
textInputs : $( "input[ type=text ]", this.panel ),
policyNumber : getContentElement( "txtPolicyNumber", this.textInputs ),
policyNumberError : getContentElement( "lblPolicyNumberError", this.panel ),
password : getContentElement( "txtPassword", this.textInputs ),
passwordError : getContentElement( "lblPasswordError", this.panel ),
forgotPasswordLink : getContentElement( "lbtnForgotPassword", this.panel ),
init : function ()
{
log( "initializing policy logon" );
var that = this;
// Other event handlers created here [redacted to keep example code short].
that.forgotPasswordLink.on("click", function ()
{
// Code to wait for PostBack should go here.
page.init();
});
that.policyNumber.focus();
}
};
var forgotPassword =
{
// Local vars, set up the same way as Policy Logon, just different elements.
// [redacted to keep example code short]
init : function ()
{
log( "initializing forgot password" );
var that = this;
// Other event handlers created here [redacted to keep example code short].
that.policyNumber.focus();
}
};
作为对什么是 getContentElement()
问题的先发制人的打击,getContentElement()
是我必须创建的函数,因为嵌套母版页中的元素必须根据他们使用的母版页的不同而不同。它看起来像这样:
function getContentElement ( id, context )
{
var publicPrefix = csMasterPrefix + csContentPrefix,
securePrefix = cpMasterPrefix + publicPrefix + cpContentPrefix,
publicId = "#" + publicPrefix + id,
secureId = "#" + securePrefix + id;
return ( context )
? ( isSecurePage ) ? $( secureId, context ) : $( publicId, context )
: ( isSecurePage ) ? $( secureId ) : $( publicId );
}
最佳答案
与其直接调用 page.init(),不如将其绑定(bind)到 body 的 onLoad even。
$(document).ready() { page.init() }
此时,DOM已经从服务器返回,ActiveIndexItem
也已经设置。
关于javascript - 如何等待 ASP.NET Multiview 通过 PostBack 更改其 ActiveViewIndex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5783413/
我正在进入网络开发领域,并且看到了回发这个词。来自非 Web 背景的新 Web 开发人员需要了解哪些关于回发的知识? (即它们是什么以及它们何时出现?) 如果您愿意分享更多信息来帮助网络世界的新手了解
1> 只是想了解 SignalR 1.x 在特定场景下的功能 假设我们有 10 个客户端连接到 Hub,其中一个连接的客户端说 client-1 执行回发,所以调用 OnDisconnected 而不
我的站点当前实现了我们已在IIS中映射的自定义404页面。因此,当用户执行类似www.mysite.com/foo/bar/doesnotexist的操作时,它将执行404.aspx URL。这很好用
我有这个 aspx: 现在在 Page_Load 我想确定 PostBack 是否由 check 引起,所以我遵循了 this使用此代码的问题方法: if(FindControl(Page.Requ
我想使用 POSTBACK 方法检查用户是否存在于 mysql 表中。我正在研究 mysql,我知道它很快就会被删除,但目前我无法更改。我希望警报在用户名文本框旁边弹出(如果它已经存在)。目前它不起作
我有一个表单,可以在提交时下载生成的 csv 文件。我在页面上有一个 asp:Literal 作为加载文本的占位符: $("input[type=submit]").on("click"
我想将所选的下拉列表项插入数据库,但我的下拉列表保留返回第一个选项。自动回发是假的。代码在这里: dropTask() = 我从数据库中填充它的下拉列表。 protected void
在我的页面中有很多控件,我想知道是谁在 Page_Load 事件中导致了页面 PostBack。 最佳答案 为此你可以试试 string ctr = Page.Request.Params.Get("
我在客户端有一些验证 JS 代码,必须在 PostBack 之前执行。如果此验证码返回“false”,则无需回发。如何禁用它? 最佳答案 请记住,真正的验证应该始终在服务器上进行。您在客户端所做的任何
这是我的java脚本 $('#geoLocation').click(function () { alert("I am Here"); if (navigator.
我在运行时向 Page Form 对象添加控件。 每个控件都有一个 Id。 在回发时,我希望能够访问这些控件及其值。 目前,当我执行回发时,表单在 Form.Controls 集合中没有控件。 我该如
我在 ASP.NET 触发按钮单击两次时遇到问题。该按钮位于 UpdatePanel 内,但当我单击它时,我得到两次回传,然后单击两次按钮,然后两次调用我的 DAL(按此顺序)。我以前从未遇到过这种情
我在证明我的请求表单时遇到了一些麻烦,因此它只能提交有效信息并告诉用户什么是错误的,如果不是的话。 我希望 Controller 创建的新属性(新联系人的属性)在表单回发时被不显眼的 JS 验证为 f
这是一个一般性问题,我还没有找到答案。 我能否在代码中区分 PostBack 和刷新以确保人们不会重复提交相同的项目? 应用程序是基于 C# 的 ASP.NET。代码如下: protected voi
我会尽我所能阐明我想做的事情。 让我先声明一下,我是 C# 和 ASP.NET 的新手,对 javascript 的经验很少。 我有一个调用提示框的 javascript 函数。总体情况是——如果输入
现在我有一个带有 3 个步骤的 asp:Wizard。 创建用户 表格到电子邮件 字段摘要 当在第三步单击完成按钮时,我想创建用户并发送表单。我有写这篇文章的逻辑,但我唯一的问题是当按下向导上的下一个
我有一个 ASP.NET TextBox,我希望它是 ReadOnly。 (用户使用另一个控件修改它) 但是当有 PostBack() 时,文本会重置为空字符串。 我知道,如果您将 TextBox 的
问题 安 不更新了 背景 我有一个页面叫 Add_Edit_Drugs.aspx .可以通过以下两种方式之一访问此页面:用户可以单击 Add Drug按钮,触发 Response.Redirect("
根据 documentation,我在验证与 Skadnetwork/Apple 的回发时遇到问题苹果正在放弃。 我有两个问题(至少我认为只有两个问题)。 \u2063 - 我正在使用 PHP 从 P
我想通过在特定事件发生后将一些 AJAX 插入页面来导致仅发生一次的回发。 目前我有: string script = "" +
我是一名优秀的程序员,十分优秀!