回发功能名称和动态表单ID [英] Post Back Function Name and Dynamic Form ID

查看:67
本文介绍了回发功能名称和动态表单ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改asp.net表单的Postback

jscript函数的函数名称。我正在从多个来源收集

内容,并且在同一页面上不能有2个b $ b __doPostBack。也想

能够动态更改表单ID,但是看起来好像没有让我做一个id =" Form1<%#whatever %GT;"类型的东西。


我开始认为我必须创建我的

拥有的Page上课,但如果

可能,我想避免这种情况。如果没有,那里是否有任何血清,

可能指向我正确的方向。 Thanx在

提前....

解决方案




1)你可以根据需要渲染任何函数,只要函数设置

__Eventtarget,__ Eventventgument设置为正确值并且表单提交

事件将在服务器中发生。


2)您的意思是更改表单ID:this.FindControl(" WebForm9")。ID =

" NattyGur英寸;。你能解释一下原因吗?


Natty Gur [MVP]

电话号码:

办公室:+ 972-(0)9 -7740261

传真:+ 972-(0)9-7740261

手机:+ 972-(0)58-888377

** *通过开发人员指南 http://www.developersdex.com 发送***

不要只是参加USENET ......获得奖励!


第2部分很有效。但也许我需要以不同的方式询问第一个

问题.....


我想更改asp.net使用的函数名称要做什么

将帖子(__ doPostBack)邮寄给某些东西

就像__ doBostBack1一样或类似的东西。我怎么去

关于让asp.net使用不同的名字是JS

回发例程?

- ----原帖-----

1)你可以随意渲染任何函数,只要
函数set__Eventtarget,__ Eventargument设置为正确的值和
表单提交事件将在服务器中发生。

2)您的意思是更改表单ID:this.FindControl
(" WebForm9")。ID = QUOT; NattyGur英寸;。你能解释一下原因吗?

Natty Gur [MVP]
电话号码:
办公室:+ 972-(0)9-7740261
传真:+ 972-( 0)9-7740261
手机:+ 972-(0)58-888377

***通过Developersdex发送 http://www.developersdex.com
***不要只是参加USENET ......获得奖励!






据我所知,你可以用Render函数代替__Dopostback

with _MyOwnPostBack:


覆盖protected void Render(HtmlTextWriter writer)

{

StringBuilder oStringBuilder = new StringBuilder();

StringWriter oStringWriter = new StringWriter(oStringBuilder);

HtmlTextWriter oHtmlWriter = new HtmlTextWriter(oStringWriter);

base.Render( oHtmlWriter);


oStringBuilder = oStringBuilder.Replace(" __ dopostback",

" __ dopostb ack1");

writer.Write(oStringBuilder.ToString());

}

或者,


您可以使用Page.RegisterClientScriptBlock渲染自己的回发

函数。


Natty Gur [MVP]


博客: http://weblogs.asp.net/ngur

手机:+ 972-(0)58-888377

***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!

Is it possible to change the function name of the Postback
jscript function for a asp.net form. I''m gathering
content from multiple sources and can''t have 2
__doPostBack ''s on the same page. Also would like to be
able to dynamically change the form id, but it won''t seems
to let me do a id="Form1<%# whatever %>" type thing.

I''m beginning the to think that I will have to create my
own "Page" class, but I would like to avoid this if
possible. If not, are there any carticles out there that
might point me in the right direction. Thanx in
advance....

解决方案

Hi,

1) you can render any function as you want, as long as the function set
__Eventtarget, __Eventargument set to correct values and the form submit
the event will occurred in the server.

2) You mean to change the form ID : this.FindControl ("WebForm9").ID =
"NattyGur";. can you explain why ?

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


Part 2 worked great. But maybe i need to ask the first
question in a different way.....

I want to change the function name that asp.net uses to do
post backs ("__doPostBack") to something
like "__doBostBack1" or something like that. How do I go
about getting asp.net to use a different name for is JS
post back routine?

-----Original Message-----
Hi,

1) you can render any function as you want, as long as the function set__Eventtarget, __Eventargument set to correct values and the form submitthe event will occurred in the server.

2) You mean to change the form ID : this.FindControl ("WebForm9").ID ="NattyGur";. can you explain why ?

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***Don''t just participate in USENET...get rewarded for it!
.



Hi,

As far as I know you can use the Render function to replace __Dopostback
with _MyOwnPostBack :

override protected void Render(HtmlTextWriter writer )
{
StringBuilder oStringBuilder = new StringBuilder();
StringWriter oStringWriter = new StringWriter(oStringBuilder);
HtmlTextWriter oHtmlWriter = new HtmlTextWriter(oStringWriter);
base.Render(oHtmlWriter);

oStringBuilder = oStringBuilder.Replace("__dopostback",
"__dopostback1");
writer.Write(oStringBuilder.ToString());
}
Alternatively,

You can use Page.RegisterClientScriptBlock to render your own postback
function.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于回发功能名称和动态表单ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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