|
-
Nov 15th, 2004, 03:15 PM
#1
Thread Starter
New Member
Dynamically Adding Control Based On values from popup window
Hi -
I did this in asp and am converting to asp.net
On a form I have fields with values from 3 separate tables.
For 1 table which is a array of counties I create a "dynamic" array of controls within a div tag
The div tag contents can be changed via the innerHTML tag
<div id="countrylist">
<table>
<tr>
<td><input type="hidden" name="hdnCountryID" value="1">US</td>
</tr>
<tr>
<td><input type="hidden" name="hdnCountryID" value="2">Mexico</td>
</tr>
</table>
</div>
For example there is a hidden field and then the country name is show within a td tag.
The fields are first populated on the data load - however the user can add additional values to the array by opening a popup window and selecting country values from a list box. I then call a javascript function in which I rebuild the table with what is already there, adding a new row for the new value from the popup and set the div.innerHTML. You might want to think of this as a dynamic array of controls
Is this possible in .Net?
Thanks!
-
Nov 15th, 2004, 06:19 PM
#2
I wonder how many charact
While there is a way to add dynamic controls mirroring how you did it in asp....
Perhaps the easier way is to put these controls in a data-bound list control (repeater or datalist).
The initial values become serialized to viewstate, or stored in session.
The postback from the javascript div will pass the new values in stored into an array inside a hidden field in the form.
The asp.net framework will check for changes on that value, and parse out the values and determine new ones. It can make changes to the stored viewstate of values, and rebind the datalist control.
-
Nov 16th, 2004, 10:30 AM
#3
Thread Starter
New Member
So I need to have a hidden form on the .net page
and then bind to the datalist from the hidden field.
I also need a delete button for each row - will this work
Thanks for your help I am new to this
-
Nov 17th, 2004, 02:27 PM
#4
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|