从javascript回发 [英] Postback from javascript

查看:63
本文介绍了从javascript回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使javascript导致页面回发。我已尝试从我的脚本调用_doPostBack,但生成错误对象

预期。我想这是因为页面的脚本不包含

方法_doPostBack,需要由asp.net添加。我该如何制作

asp.net添加这个脚本?


谢谢,




-

Martin Eyles
ma *** *******@NOSPAM.bytronic.com

I am trying to get javascript to cause a page to post back. I have tried
calling _doPostBack from my script, but generates an error "object
expected". I think this is because the page''s script doesn''t contain the
method _doPostBack, which needs to be added by asp.net. How can I make
asp.net add this script?

Thanks,
ME

--
Martin Eyles
ma**********@NOSPAM.bytronic.com

推荐答案

Hello Martin,


我相信asp.net会在你添加一个linkbutton

或其他一些可能导致回发的控件时自动添加。常规按钮控件

不会触发asp.net框架添加javascript回发代码,因为

html默认支持在没有javascript干预的情况下发布表单。


我不知道如何欺骗asp.net添加此代码除了添加

a虚拟链接按钮而不设置文本属性,这将使

linkbutton不占用任何空间或对用户不可见...


我确定有更好的方法可以实现这一点,因为我建议

是一个解决方法。

-john
Hello Martin,

I believe asp.net automatically adds this as soon as you add a linkbutton
or some other control that can cause a postback. Regular Button controls
would not trigger asp.net framework to add the javascript postback code since
html by default supports posting the form without javascript intervention.

I''m not sure how to trick asp.net into adding this code except for adding
a dummy linkbutton and not setting the text property, which would make the
linkbutton not take any space or be invisible to the user...

i''m sure there are better ways to accomplish this as what i''m suggesting
is a work around.
-john
我试图让javascript导致页面回发。我已经尝试从我的脚本中调用_doPostBack,但是会产生错误
对象预期。我想这是因为页面的脚本没有包含方法_doPostBack,需要由asp.net添加。
如何让asp.net添加这个脚本?

谢谢,
I am trying to get javascript to cause a page to post back. I have
tried calling _doPostBack from my script, but generates an error
"object expected". I think this is because the page''s script doesn''t
contain the method _doPostBack, which needs to be added by asp.net.
How can I make asp.net add this script?

Thanks,
ME



Page.GetPostBackEventReference(this);


将触发生成javascript回发代码。你可能想要
写一个支持客户端回发的控件。


- 布鲁斯(sqlwork.com)


Martin Eyles <毫安********** @ NOSPAM.bytronic.com>在消息中写道

新闻:10 ************* @ corp.supernews.com ...

|我试图让javascript导致页面回发。我试过了

|从我的脚本调用_doPostBack,但生成错误object

|预期" ;.我想这是因为页面的脚本不包含

|方法_doPostBack,需要由asp.net添加。我该如何制作

| asp.net添加这个脚本?

|

|谢谢,

|我

|

| -

| Martin Eyles

| ma**********@NOSPAM.bytronic.com
|

|
Page.GetPostBackEventReference(this);

will trigger generation of the javascript postback code. you might want to
write a control that supports client postbacks.

-- bruce (sqlwork.com)

"Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message
news:10*************@corp.supernews.com...
| I am trying to get javascript to cause a page to post back. I have tried
| calling _doPostBack from my script, but generates an error "object
| expected". I think this is because the page''s script doesn''t contain the
| method _doPostBack, which needs to be added by asp.net. How can I make
| asp.net add this script?
|
| Thanks,
| ME
|
| --
| Martin Eyles
| ma**********@NOSPAM.bytronic.com
|
|


只需提交表格。


-

HTH,

Kevin Spencer

..Net开发人员

Microsoft MVP

两者都不跟随者

也不是贷款人。


Martin Eyles <毫安********** @ NOSPAM.bytronic.com>在留言中写道

新闻:10 ************* @ corp.supernews.com ...
Just submit the form.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message
news:10*************@corp.supernews.com...
我正在尝试获取javascript使页面回发。我已尝试从我的脚本调用_doPostBack,但会生成错误object
expected。我认为这是因为页面的脚本不包含
方法_doPostBack,需要由asp.net添加。我该如何制作
asp.net添加这个脚本?

谢谢,
我是

-
Martin Eyles
ma**********@NOSPAM.bytronic.com
I am trying to get javascript to cause a page to post back. I have tried
calling _doPostBack from my script, but generates an error "object
expected". I think this is because the page''s script doesn''t contain the
method _doPostBack, which needs to be added by asp.net. How can I make
asp.net add this script?

Thanks,
ME

--
Martin Eyles
ma**********@NOSPAM.bytronic.com



这篇关于从javascript回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆