学习asp.net,使用一个自定义分页控件.发现有时可以分页,有时则无反应,查看两种情况下的页面源代码,主要区别是可以分页的有<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>不能分页的没有.倘若不能分页的页面加入可以autopostback=true的控件,则出现上述代码,且可以分页.
想问题可能出在自定义控件上.自定义控件继承了IPostBackEventHandler接口.请问,怎样才可以dopostback功能呢?另外,此自定义控件现在双击也不会在后台自动产生代码,而有时却能自动产生,不知道什么缘故.
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>不能分页的没有.倘若不能分页的页面加入可以autopostback=true的控件,则出现上述代码,且可以分页.
想问题可能出在自定义控件上.自定义控件继承了IPostBackEventHandler接口.请问,怎样才可以dopostback功能呢?另外,此自定义控件现在双击也不会在后台自动产生代码,而有时却能自动产生,不知道什么缘故.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货