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.... 9 1945
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!
Hi Kevin,
Based on my research and experience, the __doPostBack function was
generated by ASP.NET and we cannot rename it.
However, to my knowledge, we can implement your task by hooking the call to
this function. Please check out the following two articles for this idea.
HOW TO: Manually Post Back for Specific Events in an .aspx Page Using
Visual Basic .NET http://support.microsoft.com/default...b;en-us;328923
How postback works in ASP.NET http://www.xefteri.com/articles/dec102002/default.aspx
Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.
Best regards,
Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Jacob,
What I'm trying to do is have the page rename the
__doPostBack Javascript function name. Currently I found
a way to do it by creating my own Inheriting from the Page
class and overriding the Rendering method. This, however,
seems to ineffectient, but may be the only way for me to
do it. The following is my inheritied class code:
public class NewPage : System.Web.UI.Page
{
public NewPage():base()
{
}
protected override void Render
(HtmlTextWriter writer)
{
StringBuilder sb = new
StringBuilder();
StringWriter sw = new StringWriter
(sb);
HtmlTextWriter htw = new
HtmlTextWriter(sw);
base.Render(htw);
string html = sb.ToString().Replace
("__doPostBack","__newDoPostBack");;
writer.Write (html);
}
}
This works with the following snippet of html:
function __newDoPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase
().indexOf("netscape") > -1) {
theform = document.forms
["sometingnew"];
}
else {
theform = document.sometingnew;
}
theform.__EVENTTARGET.value =
eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value =
eventArgument;
theform.submit();
}
.......{snip}....
<select name="DropDownList1" onchange="__newDoPostBack
('DropDownList1','')"
.......{snip}....
It does do what I want it to do, but I hate all the string
manipulation. What I was hoping for was a property or
method to set this value for the framework.
Is there another way to do this? -----Original Message----- Hi Kevin,
Based on my research and experience, the __doPostBack
function was generated by ASP.NET and we cannot rename it.
However, to my knowledge, we can implement your task by
hooking the call to this function. Please check out the following two
articles for this idea. HOW TO: Manually Post Back for Specific Events in
an .aspx Page Using Visual Basic .NET http://support.microsoft.com/default.aspx?scid=kb;en-
us;328923 How postback works in ASP.NET http://www.xefteri.com/articles/dec102002/default.aspx
Does it answer your question? If I have misunderstood
your concern, please feel free to let me know.
Best regards,
Jacob Yang Microsoft Online Partner Support Get Secure! ¨C www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. .
Repost (Forgot my nospam alias)
Jacob,
What I'm trying to do is have the page rename the
__doPostBack Javascript function name. Currently I found
a way to do it by creating my own Inheriting from the Page
class and overriding the Rendering method. This, however,
seems to ineffectient, but may be the only way for me to
do it. The following is my inheritied class code:
public class NewPage : System.Web.UI.Page
{
public NewPage():base()
{
}
protected override void Render
(HtmlTextWriter writer)
{
StringBuilder sb = new
StringBuilder();
StringWriter sw = new StringWriter
(sb);
HtmlTextWriter htw = new
HtmlTextWriter(sw);
base.Render(htw);
string html = sb.ToString().Replace
("__doPostBack","__newDoPostBack");;
writer.Write (html);
}
}
This works with the following snippet of html:
function __newDoPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase
().indexOf("netscape") > -1) {
theform = document.forms
["sometingnew"];
}
else {
theform = document.sometingnew;
}
theform.__EVENTTARGET.value =
eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value =
eventArgument;
theform.submit();
}
........{snip}....
<select name="DropDownList1" onchange="__newDoPostBack
('DropDownList1','')"
........{snip}....
It does do what I want it to do, but I hate all the string
manipulation. What I was hoping for was a property or
method to set this value for the framework.
Is there another way to do this? -----Original Message----- Hi Kevin,
Based on my research and experience, the __doPostBack
function was generated by ASP.NET and we cannot rename it.
However, to my knowledge, we can implement your task by
hooking the call to this function. Please check out the following two
articles for this idea. HOW TO: Manually Post Back for Specific Events in
an .aspx Page Using Visual Basic .NET http://support.microsoft.com/default.aspx?scid=kb;en-
us;328923 How postback works in ASP.NET http://www.xefteri.com/articles/dec102002/default.aspx
Does it answer your question? If I have misunderstood
your concern, please feel free to let me know.
Best regards,
Jacob Yang Microsoft Online Partner Support Get Secure! ¨C www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. .
Repost (Forgot my nospam alias) one more time.....
Jacob,
What I'm trying to do is have the page rename the
__doPostBack Javascript function name. Currently I found
a way to do it by creating my own Inheriting from the Page
class and overriding the Rendering method. This, however,
seems to ineffectient, but may be the only way for me to
do it. The following is my inheritied class code:
public class NewPage : System.Web.UI.Page
{
public NewPage():base()
{
}
protected override void Render
(HtmlTextWriter writer)
{
StringBuilder sb = new
StringBuilder();
StringWriter sw = new StringWriter
(sb);
HtmlTextWriter htw = new
HtmlTextWriter(sw);
base.Render(htw);
string html = sb.ToString().Replace
("__doPostBack","__newDoPostBack");;
writer.Write (html);
}
}
This works with the following snippet of html:
function __newDoPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase
().indexOf("netscape") > -1) {
theform = document.forms
["sometingnew"];
}
else {
theform = document.sometingnew;
}
theform.__EVENTTARGET.value =
eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value =
eventArgument;
theform.submit();
}
.........{snip}....
<select name="DropDownList1" onchange="__newDoPostBack
('DropDownList1','')"
.........{snip}....
It does do what I want it to do, but I hate all the string
manipulation. What I was hoping for was a property or
method to set this value for the framework.
Is there another way to do this? -----Original Message----- Hi Kevin,
Based on my research and experience, the __doPostBack
function was generated by ASP.NET and we cannot rename it.
However, to my knowledge, we can implement your task by
hooking the call to this function. Please check out the following two
articles for this idea. HOW TO: Manually Post Back for Specific Events in
an .aspx Page Using Visual Basic .NET http://support.microsoft.com/default.aspx?scid=kb;en-
us;328923 How postback works in ASP.NET http://www.xefteri.com/articles/dec102002/default.aspx
Does it answer your question? If I have misunderstood
your concern, please feel free to let me know.
Best regards,
Jacob Yang Microsoft Online Partner Support Get Secure! ¨C www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. .
Hi Kevin,
Thank you for your update
After I posted my previous reply, I also tried the override of the Render
method. As you tried above, by overriding the Render method, we can
implement the task to change the __doPostBack function to any others.
Although this approach can be used to implement our task, it is not a usual
operation. That is why I didn't recommend you last time.
By discussing with some other experts in this field, it comes that there is
no direct method or property to change the name of this function.
Please let me know if it makes sense.
Best regards,
Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Thanx for your help. I thought this might be the case.... -----Original Message----- Hi Kevin,
Thank you for your update
After I posted my previous reply, I also tried the
override of the Render method. As you tried above, by overriding the Render
method, we can implement the task to change the __doPostBack function to
any others. Although this approach can be used to implement our task,
it is not a usual operation. That is why I didn't recommend you last time.
By discussing with some other experts in this field, it
comes that there is no direct method or property to change the name of this
function. Please let me know if it makes sense.
Best regards,
Jacob Yang Microsoft Online Partner Support Get Secure! ¨C www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. . This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: khawar |
last post by:
my application is in asp.net using C#
hi guys having a complicated problem
i am using payflowlink to process CC payments
I have to send a httppost to their servers. The problem
is how do i do a...
|
by: Gary Vidal |
last post by:
I have a client side Javascript which checks an OrderQuantityField against a hidden Textbox of the Minimum Order Quantity. I dont want to do validation on a postback. I would like to be able to...
|
by: Brian Henry |
last post by:
I have two list boxes on my form... lstCanSend and lstRecipients... well
then there are two buttons add and remove between them (your basic select
and pick listing) which uses java script to move...
|
by: Matt |
last post by:
When we submit the form data to another page, we usually do the following:
<form action="display.aspx" method="post"> will submit the form data and
open
display.asp in the current browser
...
|
by: WIWA |
last post by:
Hi,
I want to login to a password protected website and fetch the content of the
page behind. I have based my code on
http://weblogs.asp.net/jdennany/archive/2005/04/23/403971.aspx. When I use...
|
by: Bjorn |
last post by:
Hi.
Every time i post data in a form the contents are being checked for
validity.
When i click the back-button, all data is gone and i have to retype it.
It's obvious that only a few or none of...
|
by: Michael Lang |
last post by:
I'm adding checkbox controls to a panel in a post back, I then have a second
post back in which I attempt to process the checkbox controls however they
seem to have disappeared off the panel. The...
|
by: Derek Basch |
last post by:
I spent several hours struggling with dynamic form fields added with
appendChild or innerHTML not POSTing on submit in Firefox. The only
way I found to make it work is to append any created fields...
|
by: sunbin |
last post by:
Hi,
I am having in a Trouble when working with dynamic checkboxes (i.e. checkboxes with the same name, e.g. <input type="checkbox" name = "check" value="dynamic integer value">)
I have...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |