473,466 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

__doPostBack Arguments question

below is the html of two dropdownlists as they are rendered. The first was
created with Postback = false and I added the
onchange="myFunction('DropDownList1,'') in code. I made this look very much
like the asp generated onchange attribute in the second dropdown where
postback was set as true.

In the standard DropDownList2 the second argument is called eventArgument.
although the call to __doPostBack has it as ' ' there must be something that
gets passed in it because it has a value when it gets to the javascript
__doPostback function. I figured that maybe the code in the DropDwonList
object is putting the necessary data into that argument somehow.

I have attempted to simulate that with dropdown1 but the second argument is
indeed blank when it gets to the myFuction argument.

So, the questions is: how does the eventargument data get into the second
argument in the case of DropDownList2?? I hope to make it do the same thing
when going to my javascript function.


<select name="DropDownList1" id="DropDownList1"
onchange="myFunction('DropDownList1','')" style="width:128px;Z-INDEX: 101;
LEFT: 80px; POSITION: absolute; TOP: 32px">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>

</select>
<select name="DropDownList2" onchange="__doPostBack('DropDownList2','')"
language="javascript" id="DropDownList2" style="width:120px;Z-INDEX: 102;
LEFT: 296px; POSITION: absolute; TOP: 32px">
<option value="three3">three3</option>
<option value="4">four</option>
<option value="5">five</option>

--
Regards,
Gary Blakely
Apr 9 '06 #1
6 3298
On Sun, 9 Apr 2006 10:28:09 -0700, GaryDean wrote:
I have attempted to simulate that with dropdown1 but the second argument is
indeed blank when it gets to the myFuction argument.


There are a number of things that go on in the background here, that you
will have to recreate to do this.

First, if you look at the __doPostBack function, you will notice that it
encodes the control into the __EVENTTARGET hidden field. This is what
allows the HttpModule that your pages derive from (usually Page) to know
that there was an event it was processing.

Once the HttpModule gets it, it will then take that value, decode it, then
extract the value from the postback information for the control.

ie, something like Request("DropDownList1")
Apr 9 '06 #2
it encodes it by....
theform.__EVENTARGUMENT.value = eventArgument;

but my point is that when MY javascript function gets eventArgument it is a
blank string so I think this is happening before the transformations you
refer to.

Gary
"Erik Funkenbusch" <er**@despam-funkenbusch.com> wrote in message
news:3x**************@funkenbusch.com...
On Sun, 9 Apr 2006 10:28:09 -0700, GaryDean wrote:
I have attempted to simulate that with dropdown1 but the second argument
is
indeed blank when it gets to the myFuction argument.


There are a number of things that go on in the background here, that you
will have to recreate to do this.

First, if you look at the __doPostBack function, you will notice that it
encodes the control into the __EVENTTARGET hidden field. This is what
allows the HttpModule that your pages derive from (usually Page) to know
that there was an event it was processing.

Once the HttpModule gets it, it will then take that value, decode it, then
extract the value from the postback information for the control.

ie, something like Request("DropDownList1")

Apr 10 '06 #3
Reread what I wrote. I explained exactly how it works.

On Sun, 9 Apr 2006 17:46:53 -0700, GaryDean wrote:
it encodes it by....
theform.__EVENTARGUMENT.value = eventArgument;

but my point is that when MY javascript function gets eventArgument it is a
blank string so I think this is happening before the transformations you
refer to.

Gary
"Erik Funkenbusch" <er**@despam-funkenbusch.com> wrote in message
news:3x**************@funkenbusch.com...
On Sun, 9 Apr 2006 10:28:09 -0700, GaryDean wrote:
I have attempted to simulate that with dropdown1 but the second argument
is
indeed blank when it gets to the myFuction argument.


There are a number of things that go on in the background here, that you
will have to recreate to do this.

First, if you look at the __doPostBack function, you will notice that it
encodes the control into the __EVENTTARGET hidden field. This is what
allows the HttpModule that your pages derive from (usually Page) to know
that there was an event it was processing.

Once the HttpModule gets it, it will then take that value, decode it, then
extract the value from the postback information for the control.

ie, something like Request("DropDownList1")

Apr 10 '06 #4
Thanks for Erik's input.

Hi Gary, as for the ASP.NET's generated __doPostBack function, it will
accept some additional data when the postback is generted from some nested
subcontrols in a container control. Also, since the function is rendered
out ,it's code logic is quite straighforward there. BTW, if you want to do
your own postback and pass some additional argument, you can consider
putting a custom html input hidden field which store your custom data.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Apr 10 '06 #5
Steven,
I think I need to get more generic about what I am trying to do....

Almost all of the web controls call the __Postback function and they get the
data to it that I eventually get in my various web control events. I want
to find a way to pass that same information to a javascript function. for
instance if it's a dropdown I want to get selectedindex, selectedvalue, etc.

I figured out how to do this for the Calendar control because it was nice
enough to provide me with a dayrender event where I can substitute my own
call for the postback call - but that call was simple, it just passed a
date.

So, is there a way to do this? - for the dropdown, the listbox, the
checkboxlist, etc?

(fyi - the reason I want to do this is because I have a 3rd party AJAX
control that the javascript can call with the data and that is an easy way
to refresh just that AJAX area).
--
Regards,
Gary Blakely

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Ox**************@TK2MSFTNGXA01.phx.gbl...
Thanks for Erik's input.

Hi Gary, as for the ASP.NET's generated __doPostBack function, it will
accept some additional data when the postback is generted from some nested
subcontrols in a container control. Also, since the function is rendered
out ,it's code logic is quite straighforward there. BTW, if you want to do
your own postback and pass some additional argument, you can consider
putting a custom html input hidden field which store your custom data.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Apr 12 '06 #6
Thanks for your response Gary,

So you're wantting to replace those built-in control's postback handler to
your own client function? If this is the case, it'll be abit hard to do so
since the postback script handler generation is encapsulated internally and
not recommended to change it. If you do want to customize it, you may need
to consider create sub class derived from the built-in one and override the
rendering specific methods.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Apr 12 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frankieboy | last post by:
Where is __doPostBack-function defined? I've got an application which generates a different __doPostBack-function when the code is being run on the server compared to the one on my laptop. The...
1
by: paul reed | last post by:
Hello, I am having some weird behavior between two machines...one which is running the 1.1 framework and one which is running 1.0. After opening a child form from a parent...I update the...
3
by: E | last post by:
I have 2 aspx pages... neither of which do anything out of the ordinary. One of the pages automatically generates this block of code when viewed at the client:...
3
by: Nikhil Patel | last post by:
Hi all, I have developed a web page with a sortable DataGrid with Select button column in ASP.Net. It works fine in inernet explorer. The purpose of the web page is to display it in a third party...
1
by: Adrian | last post by:
I appear to be losing ViewState information when calling the __doPostBack function. I am attempting to use the showModalDialog to load a new web page which confirms that a user wishes to save a...
3
by: Marcelo | last post by:
Hello, I am trying to create a postback event, and it is working, just not calling the sub. I have a datagrid which has <asp:DataGrid id="Mensajes" ... <Columns> <asp:HyperLinkColumn ....
0
by: Steve Richter | last post by:
ok, I admit I dont know what I am doing ... When a user clicks on a <tr> in a <table> I want the page to be posted back to the server with info as to what row was clicked. <tr...
3
by: Steve Wonderful | last post by:
I checked the rendered html and found __doPostBack() function was not found in the html source. Is there a reason? How do I force it to be generated. The page seems to function properly for post...
1
by: Philip | last post by:
I am attempting to use the ASP.NET generated __doPostBack JavaScript function in my custom JavaScript and I can use it successfully but only after the web page is loaded and idle. I prefer to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.