在您的页面中创建一个隐藏字段...当您提交页面时在其中设置值..再次在页面加载中您需要检查该值..
在 aspx
<asp:HiddenField ID="hdnfld" runat="server"/>
现在在 JS 中:-
<script type="text/javascript">
$(document).ready(function () {
var myval=$("#hdnfld").val();
if(myval=="submitted"){
// this will execute after submit:-// you can add necessary code here :-
$('.modal_part').fadeIn('slow');
$('#tn_select').load('OnBoarding.aspx');
// Set its value again to null;
$("#hdnfld").val("");
}
else
{
// This will execute when page will load first time :-
$('.modal_part').fadeIn('slow');
$('#tn_select').load('OnBoarding.aspx');
}
});
</script>
在后面的代码中:-
protected void btn1_clicked(object sender,EventArgs e){
// set the hdn field:-
hdnfld.value="submitted";
}