Ask a Question related to ASP.NET General, Design and Development.
-
Rick #1
dynamic forms
I am developing a user control that builds dynamic forms
taken from a string
(str_output).
I have a string such as <table><tr><td><asp:checkbox
id="chk1"
runat="server" /><asp:checkbox id="chk2"
runat="server" /></td></tr></table>
Note this is generated from by the call
obj_dbMediaFile.GetMedia (this is a
component I have written)
I have a code behind script which as the following
structure:
sub page_load
if not page.IsPostBack then
CreateContent()
end if
end sub
The create content function puts the string above into a
label called
output:
Public sub CreateContent
dim obj_dbMediaFile as dbMediaFile
str_output =
obj_dbMediaFile.GetMedia
(1,int_currentRecord.value,int_PageSize)
dim obj_control as new Control
obj_control = ParseControl(str_output)
output.Controls.Add(obj_control)
end sub
On running the script the form elements in the string are
correctly
rendered. When a normal button called btn_delete
(hardcoded into the ascx
file) is pressed the function btn_delete_click is called.
Public sub btn_delete_Click(Sender as object ,E as
system.EventArgs )
CreateContent()
IterateThroughControls(me)
end sub
This calls the form creation function and then calls the
function
IterateThroughControls(me).
Sub IterateThroughControls(parent as Control )
Dim obj_control as Control
for each obj_Control in parent.Controls
if typeof obj_Control is checkbox then
'This would suggest that at this point the obj_control
has not been updated
if CType(obj_control, checkbox).checked = true then
testing.Text += "true"
else
testing.Text += "false"
end if
end if
if obj_Control.Controls.Count > 0 then
IterateThroughControls(obj_Control)
end if
next
end sub
This function finds all the rendered checkboxs. This
works fine, whoever it
doesn't seem to be able to access there value (always
sets the label test =
false(s)).
I have noticed that if I try to access the value of the
label named output
(which houses the rendered form elements and is set in
the CreateContent()
function) and place it into another hardcoded label, the
value is empty even
thogh the content has been rendered to the screen.
Any ideas what the problem is?
Rick Guest
-
Flash forms, dynamic content
:confused; I am relatively new to assembling Flash Forms. I am trying to build a form that lists departments in a dropdown on one tab and will... -
Forms dynamic upate
I would like to update a record using list and combo boxes. I do I accomplish this? -
Dynamic Forms authorization
Hi all I'm creating web application with windows integrated security. Every window user is member of one of the groups of managers or operators.... -
Trying to build dynamic forms
Hello, I am working on a database that uses multiple forms to collect data that is then called in a subsequent form (for example: data entered... -
Dynamic forms problem
Hi all, I'm building a form dynamicly. Adding textboxes as needed in the code-behind. They appear in a table. When I submit the form I cannot...



Reply With Quote

