asp:UpdatePanel中js失效问题已解决

 

1.js

function textSAll(o) {
o.select();
}
var dddd_dd = function () {
$(":text").on("click", function () {
textSAll(this);
});
};
$(function () {
dddd_dd();
});
$(function () {
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function (evt, args) {
dddd_dd();

});
});

2.关于div信息提示框,后台重新注册js事件的

protected void resizePageJS()
{
Random Rdm = new Random();
long m = DateTime.Now.ToFileTimeUtc();
int r = Rdm.Next(1, Int32.MaxValue);
try
{
if (!string.IsNullOrEmpty(Message))
{
ScriptManager.RegisterStartupScript(updatePanel_page, this.Page.GetType(), m + "_" + r, "showErrorMsg(\"" + Message + "\");hideLoading();", true);
//ScriptManager.RegisterStartupScript(updatePanel_page, this.Page.GetType(), m + "_" + r, "setpadleft();showErrorMsg('" + Message + "');hideLoading();", true);
}
else
{
ScriptManager.RegisterStartupScript(updatePanel_page, this.Page.GetType(), m + "_" + r, "setpadleft(); hideLoading();", true);
}
}
catch (Exception e) { }
}

信息提示框

<div class="modal fade" id="MessageModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title"><i class="glyphicon glyphicon-info-sign"></i>
信息提示</h4>
</div>
<div class="modal-body text-center">
<p class="text-danger"><span id="errorMsg"></span></p>

</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">确认</button>
</div>
</div>
</div>
</div>

后台cs

public string Message
{
set;
get;
}

 

你可能感兴趣的:(update)