R
Rick
Hi,
I'm using AS.NET 2.0 with VB.
I have a page with a dropdown on it, which is populated as follows:
When the page first loads, the dropdown is empty (no items).
When another dropdown on the same page changes the selection, a
Javascript function is called.
The JS function creates an IFrame and a Form, and posts (using POST)
to the code behind page, passing the parameters in the url.
When the VB code behind page receives those especific parameters, is
calls a procedure that retrieves the data from the database, and
generates a string containing Javascript code.
This JS code iterates thru the retrieved data, creating an "OPTION"
HTML element (a DOM object), and asigning to each OPTION the value
from the corresponding database record. The created OPTION DOM object
is added to the dropdown object.
Then the string containing the JS is written to the page using
Response.Write(myString).
The page is displayed, and the dropdown does show the items, and the
user can select.
When the page's Save button is clicked, its onclientclick event calls
a JS validation function that checks that an item is selected from the
dropdown.
If I step thru the code using Visual Studio debugger, I can inspect
the dropdown in the JS validation function, and it does have all the
items, and the one selected by the user is in the dropdown's value
member.
Then the flow of control enters the Load() function in the page's code
behind.
Inside Load(), if I inspect the dropdown again, it has 0 items.
I just don't know how or why does this happen.
After the Validate JS function ends, I cannot step through the code
any further, so I have a breakpoint in the page Load event handler.
Somewhere between these 2 points the dropdown loses all its options.
If I look at the HTM generated while debugging, the dropdown appears
as an empty <select ...></select> with no <option> in between, and the
Javascript that was generated in a string and written to the page, is
not there... but somehow it should have been at some point, b/c it
populated the dropdown.
Your helpwith this will be greatly appreciated,
Sincerely,
Rick
I'm using AS.NET 2.0 with VB.
I have a page with a dropdown on it, which is populated as follows:
When the page first loads, the dropdown is empty (no items).
When another dropdown on the same page changes the selection, a
Javascript function is called.
The JS function creates an IFrame and a Form, and posts (using POST)
to the code behind page, passing the parameters in the url.
When the VB code behind page receives those especific parameters, is
calls a procedure that retrieves the data from the database, and
generates a string containing Javascript code.
This JS code iterates thru the retrieved data, creating an "OPTION"
HTML element (a DOM object), and asigning to each OPTION the value
from the corresponding database record. The created OPTION DOM object
is added to the dropdown object.
Then the string containing the JS is written to the page using
Response.Write(myString).
The page is displayed, and the dropdown does show the items, and the
user can select.
When the page's Save button is clicked, its onclientclick event calls
a JS validation function that checks that an item is selected from the
dropdown.
If I step thru the code using Visual Studio debugger, I can inspect
the dropdown in the JS validation function, and it does have all the
items, and the one selected by the user is in the dropdown's value
member.
Then the flow of control enters the Load() function in the page's code
behind.
Inside Load(), if I inspect the dropdown again, it has 0 items.
I just don't know how or why does this happen.
After the Validate JS function ends, I cannot step through the code
any further, so I have a breakpoint in the page Load event handler.
Somewhere between these 2 points the dropdown loses all its options.
If I look at the HTM generated while debugging, the dropdown appears
as an empty <select ...></select> with no <option> in between, and the
Javascript that was generated in a string and written to the page, is
not there... but somehow it should have been at some point, b/c it
populated the dropdown.
Your helpwith this will be greatly appreciated,
Sincerely,
Rick