473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Rendering Server Controls in literal text

Joe
Hello All:

I am trying to dynamically populate a web page with literal content and
controls (textboxes and checkboxes (and eventually two buttons - the buttons
do not appear in the code yet). I read an xml file and, using the values
retrieved from it, determine what text should be displayed and which controls
should be rendered and - most importantly - where those controls should be
rendered.

The ultimate goal is to have some text followed by a control that will
capture the users response and post it back to the server. For example the
page might show:

Please enter the dollar amount: [textbox goes here].
Was this an accident? [checkbox for yes] Yes [checkbox for no] No

The problem is that all of the controls are rendered at the top of the page
and all of the text renders after the closing html tag. I don't know why
this is and I don't know enough about the Render method to speak
intelligently about it. I hope that I have explained clearly what I am
trying to do. If not please let me know.

The code is here:

Structure DynamicControl
Dim Type As String
Dim FieldType As String
Dim Name As String
Dim FieldName As String
Dim Size As String
Dim MaxLength As String
Dim EntryType As String
End Structure

Private doc As XmlDocument
Private Lines As XmlNodeList
Private ReqData As XmlNodeList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.BufferOutput = True
Dim Line As XmlNode
Dim ChildNode As XmlNode
Dim DynamicEntry As XmlNode

output = New HtmlTextWriter(txtWtr)

doc = New XmlDocument
doc.Load("C:\SampleForm.xml")

Lines = doc.GetElementsByTagName("Line")
ReqData = doc.GetElementsByTagName("Data")

For Each Line In Lines
If Line.HasChildNodes Then
For Each ChildNode In Line.ChildNodes
Dim attrList As XmlAttributeCollection =
ChildNode.Attributes
If Not (attrList Is Nothing) Then
Dim DynCtl As DynamicControl =
ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)

Select Case DynCtl.FieldType.ToLower
Case "checkbox"
Dim c As CheckBox = New CheckBox
c.ID = attrList.GetNamedItem("id").Value
c.Text = DynCtl.Name
Me.Controls(1).Controls.Add(c)

Case "text"
Dim t As TextBox = New TextBox
t.ID = attrList.GetNamedItem("id").Value
t.MaxLength = CType(DynCtl.MaxLength, Integer)
t.Text = DynCtl.Name
Me.Controls(1).Controls.Add(t)

End Select
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
End Sub

Private Function ParseDynamicCtrlData(ByVal id As String) As
DynamicControl
Dim DataNode As XmlNode
Dim dc As DynamicControl

For Each DataNode In ReqData
If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
dc.FieldType = DataNode.Attributes("fieldtype").Value
If dc.FieldType.ToLower = "text" Then
If String.Compare(DataNode.Attributes("type").Value,
"merge") <> 0 Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value
dc.Size = DataNode.Attributes("size").Value
dc.MaxLength = DataNode.Attributes("maxlength").Value
End If

ElseIf dc.FieldType.ToLower = "checkbox" Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value

End If
Exit For
End If
Next

Return dc
End Function

The XML is here:

<Form>
<Content>
<Line><Dynamic type="text" id="DateField"/></Line>
<Line/>
<Line><Dynamic type="text" id="CustomAddress1"/></Line>
<Line><Dynamic type="text" id="CustomAddress2"/></Line>
<Line><Dynamic type="text" id="CustomAddress3"/></Line>
<Line><Dynamic type="text" id="CustomAddress4"/></Line>
<Line/>
<Line/>
<Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
<Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
<Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
<Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
<Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
<Line/>
<Line>We are asking you to please complete the following with regard to
your No-Fault file on the above mentioned insured.</Line>
<Line/>
<Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
<Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
<Line>Essential Services paid: <Dynamic type="text"
id="EssentialServicesPaid"/></Line>
<Line>Advise if threshold passed: <Dynamic
type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
id="AdviseThresholdNo"/> No</Line>
<Line>Have you conducted an IME at this time? <Dynamic
type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
type="checkbox" id="ConductedIMENo"/> No</Line>
<Line>If not, do you contemplate scheduling one? <Dynamic
type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
<Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
<Line>We thank you for your cooperation and are enclosing a return envelope
for your convenience.</Line>
<Line/>
<Line>Sincerely,</Line>
<Line/>
<Line/>
<Line/>
<Line/>
<Line><Dynamic type="text" id="AdjusterName"/></Line>
<Line><Dynamic type="text" id="AdjusterPhone"/></Line>
<Line/>
<Line>Claims Department</Line>
<Line/>
<Line/>
<Line>WB-204 (12-99)</Line>
</Content>
<RequiredData>
<Data fieldtype="NowDate" name="DateField"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress1"
fieldname="CustomAddress1" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress2"
fieldname="CustomAddress2" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress3"
fieldname="CustomAddress3" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress4"
fieldname="CustomAddress4" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourInsured"
fieldname="YourInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurInsured"
fieldname="OurInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="DateOfLoss"
fieldname="DateOfLoss" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="MedicalPaid"
fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="WageLossPaid"
fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
fieldname="EssentialServicesPaid" size="30" maxlength="20"
entrytype="Numeric"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
fieldname="AdviseThresholdYes"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
fieldname="AdviseThresholdNo"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
fieldname="ConductedIMEYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
fieldname="ConductedIMENo"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
fieldname="ContemplateSchedulingYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
fieldname="ContemplateSchedulingNo"/>
<Data type="Entry" fieldtype="Text" name="NatureOfInjury"
fieldname="NatureOfInjury" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterName"
fieldname="AdjusterName" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterPhone"
fieldname="AdjusterPhone" size="30" maxlength="30"/>
</RequiredData>
</Form>

Any help would be greatly appreciated.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
Nov 19 '05 #1
14 2287
if I read it right you are simply adding the controls to the page, but not
specifying where.
You may want to look at the placeholder to use to add your controls to.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Hello All:

I am trying to dynamically populate a web page with literal content and
controls (textboxes and checkboxes (and eventually two buttons - the buttons
do not appear in the code yet). I read an xml file and, using the values
retrieved from it, determine what text should be displayed and which controls
should be rendered and - most importantly - where those controls should be
rendered.

The ultimate goal is to have some text followed by a control that will
capture the users response and post it back to the server. For example the
page might show:

Please enter the dollar amount: [textbox goes here].
Was this an accident? [checkbox for yes] Yes [checkbox for no] No

The problem is that all of the controls are rendered at the top of the page
and all of the text renders after the closing html tag. I don't know why
this is and I don't know enough about the Render method to speak
intelligently about it. I hope that I have explained clearly what I am
trying to do. If not please let me know.

The code is here:

Structure DynamicControl
Dim Type As String
Dim FieldType As String
Dim Name As String
Dim FieldName As String
Dim Size As String
Dim MaxLength As String
Dim EntryType As String
End Structure

Private doc As XmlDocument
Private Lines As XmlNodeList
Private ReqData As XmlNodeList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.BufferOutput = True
Dim Line As XmlNode
Dim ChildNode As XmlNode
Dim DynamicEntry As XmlNode

output = New HtmlTextWriter(txtWtr)

doc = New XmlDocument
doc.Load("C:\SampleForm.xml")

Lines = doc.GetElementsByTagName("Line")
ReqData = doc.GetElementsByTagName("Data")

For Each Line In Lines
If Line.HasChildNodes Then
For Each ChildNode In Line.ChildNodes
Dim attrList As XmlAttributeCollection =
ChildNode.Attributes
If Not (attrList Is Nothing) Then
Dim DynCtl As DynamicControl =
ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)

Select Case DynCtl.FieldType.ToLower
Case "checkbox"
Dim c As CheckBox = New CheckBox
c.ID = attrList.GetNamedItem("id").Value
c.Text = DynCtl.Name
Me.Controls(1).Controls.Add(c)

Case "text"
Dim t As TextBox = New TextBox
t.ID = attrList.GetNamedItem("id").Value
t.MaxLength = CType(DynCtl.MaxLength, Integer)
t.Text = DynCtl.Name
Me.Controls(1).Controls.Add(t)

End Select
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
End Sub

Private Function ParseDynamicCtrlData(ByVal id As String) As
DynamicControl
Dim DataNode As XmlNode
Dim dc As DynamicControl

For Each DataNode In ReqData
If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
dc.FieldType = DataNode.Attributes("fieldtype").Value
If dc.FieldType.ToLower = "text" Then
If String.Compare(DataNode.Attributes("type").Value,
"merge") <> 0 Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value
dc.Size = DataNode.Attributes("size").Value
dc.MaxLength = DataNode.Attributes("maxlength").Value
End If

ElseIf dc.FieldType.ToLower = "checkbox" Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value

End If
Exit For
End If
Next

Return dc
End Function

The XML is here:

<Form>
<Content>
<Line><Dynamic type="text" id="DateField"/></Line>
<Line/>
<Line><Dynamic type="text" id="CustomAddress1"/></Line>
<Line><Dynamic type="text" id="CustomAddress2"/></Line>
<Line><Dynamic type="text" id="CustomAddress3"/></Line>
<Line><Dynamic type="text" id="CustomAddress4"/></Line>
<Line/>
<Line/>
<Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
<Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
<Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
<Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
<Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
<Line/>
<Line>We are asking you to please complete the following with regard to
your No-Fault file on the above mentioned insured.</Line>
<Line/>
<Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
<Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
<Line>Essential Services paid: <Dynamic type="text"
id="EssentialServicesPaid"/></Line>
<Line>Advise if threshold passed: <Dynamic
type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
id="AdviseThresholdNo"/> No</Line>
<Line>Have you conducted an IME at this time? <Dynamic
type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
type="checkbox" id="ConductedIMENo"/> No</Line>
<Line>If not, do you contemplate scheduling one? <Dynamic
type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
<Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
<Line>We thank you for your cooperation and are enclosing a return envelope
for your convenience.</Line>
<Line/>
<Line>Sincerely,</Line>
<Line/>
<Line/>
<Line/>
<Line/>
<Line><Dynamic type="text" id="AdjusterName"/></Line>
<Line><Dynamic type="text" id="AdjusterPhone"/></Line>
<Line/>
<Line>Claims Department</Line>
<Line/>
<Line/>
<Line>WB-204 (12-99)</Line>
</Content>
<RequiredData>
<Data fieldtype="NowDate" name="DateField"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress1"
fieldname="CustomAddress1" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress2"
fieldname="CustomAddress2" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress3"
fieldname="CustomAddress3" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress4"
fieldname="CustomAddress4" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourInsured"
fieldname="YourInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurInsured"
fieldname="OurInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="DateOfLoss"
fieldname="DateOfLoss" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="MedicalPaid"
fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="WageLossPaid"
fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
fieldname="EssentialServicesPaid" size="30" maxlength="20"
entrytype="Numeric"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
fieldname="AdviseThresholdYes"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
fieldname="AdviseThresholdNo"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
fieldname="ConductedIMEYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
fieldname="ConductedIMENo"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
fieldname="ContemplateSchedulingYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
fieldname="ContemplateSchedulingNo"/>
<Data type="Entry" fieldtype="Text" name="NatureOfInjury"
fieldname="NatureOfInjury" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterName"
fieldname="AdjusterName" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterPhone"
fieldname="AdjusterPhone" size="30" maxlength="30"/>
</RequiredData>
</Form>

Any help would be greatly appreciated.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #2
Joe
Curt,

Since I will have no idea how many controls I am adding for a given page
(that is determined by the xml), how would I handle the ambiguity of not
knowing how many placeholders to add?

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
if I read it right you are simply adding the controls to the page, but not
specifying where.
You may want to look at the placeholder to use to add your controls to.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Hello All:

I am trying to dynamically populate a web page with literal content and
controls (textboxes and checkboxes (and eventually two buttons - the buttons
do not appear in the code yet). I read an xml file and, using the values
retrieved from it, determine what text should be displayed and which controls
should be rendered and - most importantly - where those controls should be
rendered.

The ultimate goal is to have some text followed by a control that will
capture the users response and post it back to the server. For example the
page might show:

Please enter the dollar amount: [textbox goes here].
Was this an accident? [checkbox for yes] Yes [checkbox for no] No

The problem is that all of the controls are rendered at the top of the page
and all of the text renders after the closing html tag. I don't know why
this is and I don't know enough about the Render method to speak
intelligently about it. I hope that I have explained clearly what I am
trying to do. If not please let me know.

The code is here:

Structure DynamicControl
Dim Type As String
Dim FieldType As String
Dim Name As String
Dim FieldName As String
Dim Size As String
Dim MaxLength As String
Dim EntryType As String
End Structure

Private doc As XmlDocument
Private Lines As XmlNodeList
Private ReqData As XmlNodeList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.BufferOutput = True
Dim Line As XmlNode
Dim ChildNode As XmlNode
Dim DynamicEntry As XmlNode

output = New HtmlTextWriter(txtWtr)

doc = New XmlDocument
doc.Load("C:\SampleForm.xml")

Lines = doc.GetElementsByTagName("Line")
ReqData = doc.GetElementsByTagName("Data")

For Each Line In Lines
If Line.HasChildNodes Then
For Each ChildNode In Line.ChildNodes
Dim attrList As XmlAttributeCollection =
ChildNode.Attributes
If Not (attrList Is Nothing) Then
Dim DynCtl As DynamicControl =
ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)

Select Case DynCtl.FieldType.ToLower
Case "checkbox"
Dim c As CheckBox = New CheckBox
c.ID = attrList.GetNamedItem("id").Value
c.Text = DynCtl.Name
Me.Controls(1).Controls.Add(c)

Case "text"
Dim t As TextBox = New TextBox
t.ID = attrList.GetNamedItem("id").Value
t.MaxLength = CType(DynCtl.MaxLength, Integer)
t.Text = DynCtl.Name
Me.Controls(1).Controls.Add(t)

End Select
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
End Sub

Private Function ParseDynamicCtrlData(ByVal id As String) As
DynamicControl
Dim DataNode As XmlNode
Dim dc As DynamicControl

For Each DataNode In ReqData
If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
dc.FieldType = DataNode.Attributes("fieldtype").Value
If dc.FieldType.ToLower = "text" Then
If String.Compare(DataNode.Attributes("type").Value,
"merge") <> 0 Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value
dc.Size = DataNode.Attributes("size").Value
dc.MaxLength = DataNode.Attributes("maxlength").Value
End If

ElseIf dc.FieldType.ToLower = "checkbox" Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value

End If
Exit For
End If
Next

Return dc
End Function

The XML is here:

<Form>
<Content>
<Line><Dynamic type="text" id="DateField"/></Line>
<Line/>
<Line><Dynamic type="text" id="CustomAddress1"/></Line>
<Line><Dynamic type="text" id="CustomAddress2"/></Line>
<Line><Dynamic type="text" id="CustomAddress3"/></Line>
<Line><Dynamic type="text" id="CustomAddress4"/></Line>
<Line/>
<Line/>
<Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
<Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
<Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
<Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
<Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
<Line/>
<Line>We are asking you to please complete the following with regard to
your No-Fault file on the above mentioned insured.</Line>
<Line/>
<Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
<Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
<Line>Essential Services paid: <Dynamic type="text"
id="EssentialServicesPaid"/></Line>
<Line>Advise if threshold passed: <Dynamic
type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
id="AdviseThresholdNo"/> No</Line>
<Line>Have you conducted an IME at this time? <Dynamic
type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
type="checkbox" id="ConductedIMENo"/> No</Line>
<Line>If not, do you contemplate scheduling one? <Dynamic
type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
<Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
<Line>We thank you for your cooperation and are enclosing a return envelope
for your convenience.</Line>
<Line/>
<Line>Sincerely,</Line>
<Line/>
<Line/>
<Line/>
<Line/>
<Line><Dynamic type="text" id="AdjusterName"/></Line>
<Line><Dynamic type="text" id="AdjusterPhone"/></Line>
<Line/>
<Line>Claims Department</Line>
<Line/>
<Line/>
<Line>WB-204 (12-99)</Line>
</Content>
<RequiredData>
<Data fieldtype="NowDate" name="DateField"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress1"
fieldname="CustomAddress1" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress2"
fieldname="CustomAddress2" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress3"
fieldname="CustomAddress3" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress4"
fieldname="CustomAddress4" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourInsured"
fieldname="YourInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurInsured"
fieldname="OurInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="DateOfLoss"
fieldname="DateOfLoss" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="MedicalPaid"
fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="WageLossPaid"
fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
fieldname="EssentialServicesPaid" size="30" maxlength="20"
entrytype="Numeric"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
fieldname="AdviseThresholdYes"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
fieldname="AdviseThresholdNo"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
fieldname="ConductedIMEYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
fieldname="ConductedIMENo"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
fieldname="ContemplateSchedulingYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
fieldname="ContemplateSchedulingNo"/>
<Data type="Entry" fieldtype="Text" name="NatureOfInjury"
fieldname="NatureOfInjury" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterName"
fieldname="AdjusterName" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterPhone"
fieldname="AdjusterPhone" size="30" maxlength="30"/>
</RequiredData>
</Form>

Any help would be greatly appreciated.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #3
Repeater perhaps.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Curt,

Since I will have no idea how many controls I am adding for a given page
(that is determined by the xml), how would I handle the ambiguity of not
knowing how many placeholders to add?

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
if I read it right you are simply adding the controls to the page, but not
specifying where.
You may want to look at the placeholder to use to add your controls to.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Hello All:

I am trying to dynamically populate a web page with literal content and
controls (textboxes and checkboxes (and eventually two buttons - the buttons
do not appear in the code yet). I read an xml file and, using the values
retrieved from it, determine what text should be displayed and which controls
should be rendered and - most importantly - where those controls should be
rendered.

The ultimate goal is to have some text followed by a control that will
capture the users response and post it back to the server. For example the
page might show:

Please enter the dollar amount: [textbox goes here].
Was this an accident? [checkbox for yes] Yes [checkbox for no] No

The problem is that all of the controls are rendered at the top of the page
and all of the text renders after the closing html tag. I don't know why
this is and I don't know enough about the Render method to speak
intelligently about it. I hope that I have explained clearly what I am
trying to do. If not please let me know.

The code is here:

Structure DynamicControl
Dim Type As String
Dim FieldType As String
Dim Name As String
Dim FieldName As String
Dim Size As String
Dim MaxLength As String
Dim EntryType As String
End Structure

Private doc As XmlDocument
Private Lines As XmlNodeList
Private ReqData As XmlNodeList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.BufferOutput = True
Dim Line As XmlNode
Dim ChildNode As XmlNode
Dim DynamicEntry As XmlNode

output = New HtmlTextWriter(txtWtr)

doc = New XmlDocument
doc.Load("C:\SampleForm.xml")

Lines = doc.GetElementsByTagName("Line")
ReqData = doc.GetElementsByTagName("Data")

For Each Line In Lines
If Line.HasChildNodes Then
For Each ChildNode In Line.ChildNodes
Dim attrList As XmlAttributeCollection =
ChildNode.Attributes
If Not (attrList Is Nothing) Then
Dim DynCtl As DynamicControl =
ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)

Select Case DynCtl.FieldType.ToLower
Case "checkbox"
Dim c As CheckBox = New CheckBox
c.ID = attrList.GetNamedItem("id").Value
c.Text = DynCtl.Name
Me.Controls(1).Controls.Add(c)

Case "text"
Dim t As TextBox = New TextBox
t.ID = attrList.GetNamedItem("id").Value
t.MaxLength = CType(DynCtl.MaxLength, Integer)
t.Text = DynCtl.Name
Me.Controls(1).Controls.Add(t)

End Select
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
End Sub

Private Function ParseDynamicCtrlData(ByVal id As String) As
DynamicControl
Dim DataNode As XmlNode
Dim dc As DynamicControl

For Each DataNode In ReqData
If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
dc.FieldType = DataNode.Attributes("fieldtype").Value
If dc.FieldType.ToLower = "text" Then
If String.Compare(DataNode.Attributes("type").Value,
"merge") <> 0 Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value
dc.Size = DataNode.Attributes("size").Value
dc.MaxLength = DataNode.Attributes("maxlength").Value
End If

ElseIf dc.FieldType.ToLower = "checkbox" Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value

End If
Exit For
End If
Next

Return dc
End Function

The XML is here:

<Form>
<Content>
<Line><Dynamic type="text" id="DateField"/></Line>
<Line/>
<Line><Dynamic type="text" id="CustomAddress1"/></Line>
<Line><Dynamic type="text" id="CustomAddress2"/></Line>
<Line><Dynamic type="text" id="CustomAddress3"/></Line>
<Line><Dynamic type="text" id="CustomAddress4"/></Line>
<Line/>
<Line/>
<Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
<Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
<Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
<Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
<Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
<Line/>
<Line>We are asking you to please complete the following with regard to
your No-Fault file on the above mentioned insured.</Line>
<Line/>
<Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
<Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
<Line>Essential Services paid: <Dynamic type="text"
id="EssentialServicesPaid"/></Line>
<Line>Advise if threshold passed: <Dynamic
type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
id="AdviseThresholdNo"/> No</Line>
<Line>Have you conducted an IME at this time? <Dynamic
type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
type="checkbox" id="ConductedIMENo"/> No</Line>
<Line>If not, do you contemplate scheduling one? <Dynamic
type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
<Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
<Line>We thank you for your cooperation and are enclosing a return envelope
for your convenience.</Line>
<Line/>
<Line>Sincerely,</Line>
<Line/>
<Line/>
<Line/>
<Line/>
<Line><Dynamic type="text" id="AdjusterName"/></Line>
<Line><Dynamic type="text" id="AdjusterPhone"/></Line>
<Line/>
<Line>Claims Department</Line>
<Line/>
<Line/>
<Line>WB-204 (12-99)</Line>
</Content>
<RequiredData>
<Data fieldtype="NowDate" name="DateField"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress1"
fieldname="CustomAddress1" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress2"
fieldname="CustomAddress2" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress3"
fieldname="CustomAddress3" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress4"
fieldname="CustomAddress4" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourInsured"
fieldname="YourInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurInsured"
fieldname="OurInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="DateOfLoss"
fieldname="DateOfLoss" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="MedicalPaid"
fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="WageLossPaid"
fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
fieldname="EssentialServicesPaid" size="30" maxlength="20"
entrytype="Numeric"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
fieldname="AdviseThresholdYes"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
fieldname="AdviseThresholdNo"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
fieldname="ConductedIMEYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
fieldname="ConductedIMENo"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
fieldname="ContemplateSchedulingYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
fieldname="ContemplateSchedulingNo"/>
<Data type="Entry" fieldtype="Text" name="NatureOfInjury"
fieldname="NatureOfInjury" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterName"
fieldname="AdjusterName" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterPhone"
fieldname="AdjusterPhone" size="30" maxlength="30"/>
</RequiredData>
</Form>

Any help would be greatly appreciated.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #4
Joe
I am not following you. Would you be willing to clarify "repeater perhaps?"
How about an example?
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
Repeater perhaps.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Curt,

Since I will have no idea how many controls I am adding for a given page
(that is determined by the xml), how would I handle the ambiguity of not
knowing how many placeholders to add?

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
if I read it right you are simply adding the controls to the page, but not
specifying where.
You may want to look at the placeholder to use to add your controls to.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:

> Hello All:
>
> I am trying to dynamically populate a web page with literal content and
> controls (textboxes and checkboxes (and eventually two buttons - the buttons
> do not appear in the code yet). I read an xml file and, using the values
> retrieved from it, determine what text should be displayed and which controls
> should be rendered and - most importantly - where those controls should be
> rendered.
>
> The ultimate goal is to have some text followed by a control that will
> capture the users response and post it back to the server. For example the
> page might show:
>
> Please enter the dollar amount: [textbox goes here].
> Was this an accident? [checkbox for yes] Yes [checkbox for no] No
>
> The problem is that all of the controls are rendered at the top of the page
> and all of the text renders after the closing html tag. I don't know why
> this is and I don't know enough about the Render method to speak
> intelligently about it. I hope that I have explained clearly what I am
> trying to do. If not please let me know.
>
> The code is here:
>
> Structure DynamicControl
> Dim Type As String
> Dim FieldType As String
> Dim Name As String
> Dim FieldName As String
> Dim Size As String
> Dim MaxLength As String
> Dim EntryType As String
> End Structure
>
> Private doc As XmlDocument
> Private Lines As XmlNodeList
> Private ReqData As XmlNodeList
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Response.BufferOutput = True
> Dim Line As XmlNode
> Dim ChildNode As XmlNode
> Dim DynamicEntry As XmlNode
>
> output = New HtmlTextWriter(txtWtr)
>
> doc = New XmlDocument
> doc.Load("C:\SampleForm.xml")
>
> Lines = doc.GetElementsByTagName("Line")
> ReqData = doc.GetElementsByTagName("Data")
>
> For Each Line In Lines
> If Line.HasChildNodes Then
> For Each ChildNode In Line.ChildNodes
> Dim attrList As XmlAttributeCollection =
> ChildNode.Attributes
> If Not (attrList Is Nothing) Then
> Dim DynCtl As DynamicControl =
> ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
>
> Select Case DynCtl.FieldType.ToLower
> Case "checkbox"
> Dim c As CheckBox = New CheckBox
> c.ID = attrList.GetNamedItem("id").Value
> c.Text = DynCtl.Name
> Me.Controls(1).Controls.Add(c)
>
> Case "text"
> Dim t As TextBox = New TextBox
> t.ID = attrList.GetNamedItem("id").Value
> t.MaxLength = CType(DynCtl.MaxLength, Integer)
> t.Text = DynCtl.Name
> Me.Controls(1).Controls.Add(t)
>
> End Select
> Else
> Dim lit As Literal = New Literal
> lit.Text = Line.InnerText & "<br/>"
> Me.Controls.Add(lit)
> End If
> Next
> Else
> Dim lit As Literal = New Literal
> lit.Text = Line.InnerText & "<br/>"
> Me.Controls.Add(lit)
> End If
> Next
> End Sub
>
> Private Function ParseDynamicCtrlData(ByVal id As String) As
> DynamicControl
> Dim DataNode As XmlNode
> Dim dc As DynamicControl
>
> For Each DataNode In ReqData
> If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> dc.FieldType = DataNode.Attributes("fieldtype").Value
> If dc.FieldType.ToLower = "text" Then
> If String.Compare(DataNode.Attributes("type").Value,
> "merge") <> 0 Then
> dc.FieldName = DataNode.Attributes("fieldname").Value
> dc.Name = DataNode.Attributes("name").Value
> dc.Size = DataNode.Attributes("size").Value
> dc.MaxLength = DataNode.Attributes("maxlength").Value
> End If
>
> ElseIf dc.FieldType.ToLower = "checkbox" Then
> dc.FieldName = DataNode.Attributes("fieldname").Value
> dc.Name = DataNode.Attributes("name").Value
>
> End If
> Exit For
> End If
> Next
>
> Return dc
> End Function
>
> The XML is here:
>
> <Form>
> <Content>
> <Line><Dynamic type="text" id="DateField"/></Line>
> <Line/>
> <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> <Line/>
> <Line/>
> <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> <Line/>
> <Line>We are asking you to please complete the following with regard to
> your No-Fault file on the above mentioned insured.</Line>
> <Line/>
> <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> <Line>Essential Services paid: <Dynamic type="text"
> id="EssentialServicesPaid"/></Line>
> <Line>Advise if threshold passed: <Dynamic
> type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> id="AdviseThresholdNo"/> No</Line>
> <Line>Have you conducted an IME at this time? <Dynamic
> type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> type="checkbox" id="ConductedIMENo"/> No</Line>
> <Line>If not, do you contemplate scheduling one? <Dynamic
> type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> <Line>We thank you for your cooperation and are enclosing a return envelope
> for your convenience.</Line>
> <Line/>
> <Line>Sincerely,</Line>
> <Line/>
> <Line/>
> <Line/>
> <Line/>
> <Line><Dynamic type="text" id="AdjusterName"/></Line>
> <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> <Line/>
> <Line>Claims Department</Line>
> <Line/>
> <Line/>
> <Line>WB-204 (12-99)</Line>
> </Content>
> <RequiredData>
> <Data fieldtype="NowDate" name="DateField"/>
> <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> fieldname="CustomAddress1" size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="CustomAddress2"
> fieldname="CustomAddress2" size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="CustomAddress3"
> fieldname="CustomAddress3" size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="CustomAddress4"
> fieldname="CustomAddress4" size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
> size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="YourInsured"
> fieldname="YourInsured" size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
> size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="OurInsured"
> fieldname="OurInsured" size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="DateOfLoss"
> fieldname="DateOfLoss" size="30" maxlength="30"/>
> <Data type="Entry" fieldtype="Text" name="MedicalPaid"
> fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
> <Data type="Entry" fieldtype="Text" name="WageLossPaid"
> fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
> <Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
> fieldname="EssentialServicesPaid" size="30" maxlength="20"
> entrytype="Numeric"/>
> <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
> fieldname="AdviseThresholdYes"/>
> <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
> fieldname="AdviseThresholdNo"/>
> <Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
> fieldname="ConductedIMEYes"/>
> <Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
> fieldname="ConductedIMENo"/>
> <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
> fieldname="ContemplateSchedulingYes"/>
> <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
> fieldname="ContemplateSchedulingNo"/>
> <Data type="Entry" fieldtype="Text" name="NatureOfInjury"
> fieldname="NatureOfInjury" size="30" maxlength="30"/>
> <Data type="Merge" fieldtype="Text" name="AdjusterName"
> fieldname="AdjusterName" size="30" maxlength="30"/>
> <Data type="Merge" fieldtype="Text" name="AdjusterPhone"
> fieldname="AdjusterPhone" size="30" maxlength="30"/>
> </RequiredData>
> </Form>
>
> Any help would be greatly appreciated.
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #5
<repeater>
<placeholder for control>
<placeholder for text for question>
</repeater>

The repeater is bound to the XML list for it's iteration/count

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
I am not following you. Would you be willing to clarify "repeater perhaps?"
How about an example?
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
Repeater perhaps.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Curt,

Since I will have no idea how many controls I am adding for a given page
(that is determined by the xml), how would I handle the ambiguity of not
knowing how many placeholders to add?

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:

> if I read it right you are simply adding the controls to the page, but not
> specifying where.
> You may want to look at the placeholder to use to add your controls to.
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "Joe" wrote:
>
> > Hello All:
> >
> > I am trying to dynamically populate a web page with literal content and
> > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > do not appear in the code yet). I read an xml file and, using the values
> > retrieved from it, determine what text should be displayed and which controls
> > should be rendered and - most importantly - where those controls should be
> > rendered.
> >
> > The ultimate goal is to have some text followed by a control that will
> > capture the users response and post it back to the server. For example the
> > page might show:
> >
> > Please enter the dollar amount: [textbox goes here].
> > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> >
> > The problem is that all of the controls are rendered at the top of the page
> > and all of the text renders after the closing html tag. I don't know why
> > this is and I don't know enough about the Render method to speak
> > intelligently about it. I hope that I have explained clearly what I am
> > trying to do. If not please let me know.
> >
> > The code is here:
> >
> > Structure DynamicControl
> > Dim Type As String
> > Dim FieldType As String
> > Dim Name As String
> > Dim FieldName As String
> > Dim Size As String
> > Dim MaxLength As String
> > Dim EntryType As String
> > End Structure
> >
> > Private doc As XmlDocument
> > Private Lines As XmlNodeList
> > Private ReqData As XmlNodeList
> >
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> >
> > Response.BufferOutput = True
> > Dim Line As XmlNode
> > Dim ChildNode As XmlNode
> > Dim DynamicEntry As XmlNode
> >
> > output = New HtmlTextWriter(txtWtr)
> >
> > doc = New XmlDocument
> > doc.Load("C:\SampleForm.xml")
> >
> > Lines = doc.GetElementsByTagName("Line")
> > ReqData = doc.GetElementsByTagName("Data")
> >
> > For Each Line In Lines
> > If Line.HasChildNodes Then
> > For Each ChildNode In Line.ChildNodes
> > Dim attrList As XmlAttributeCollection =
> > ChildNode.Attributes
> > If Not (attrList Is Nothing) Then
> > Dim DynCtl As DynamicControl =
> > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> >
> > Select Case DynCtl.FieldType.ToLower
> > Case "checkbox"
> > Dim c As CheckBox = New CheckBox
> > c.ID = attrList.GetNamedItem("id").Value
> > c.Text = DynCtl.Name
> > Me.Controls(1).Controls.Add(c)
> >
> > Case "text"
> > Dim t As TextBox = New TextBox
> > t.ID = attrList.GetNamedItem("id").Value
> > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > t.Text = DynCtl.Name
> > Me.Controls(1).Controls.Add(t)
> >
> > End Select
> > Else
> > Dim lit As Literal = New Literal
> > lit.Text = Line.InnerText & "<br/>"
> > Me.Controls.Add(lit)
> > End If
> > Next
> > Else
> > Dim lit As Literal = New Literal
> > lit.Text = Line.InnerText & "<br/>"
> > Me.Controls.Add(lit)
> > End If
> > Next
> > End Sub
> >
> > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > DynamicControl
> > Dim DataNode As XmlNode
> > Dim dc As DynamicControl
> >
> > For Each DataNode In ReqData
> > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > If dc.FieldType.ToLower = "text" Then
> > If String.Compare(DataNode.Attributes("type").Value,
> > "merge") <> 0 Then
> > dc.FieldName = DataNode.Attributes("fieldname").Value
> > dc.Name = DataNode.Attributes("name").Value
> > dc.Size = DataNode.Attributes("size").Value
> > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > End If
> >
> > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > dc.FieldName = DataNode.Attributes("fieldname").Value
> > dc.Name = DataNode.Attributes("name").Value
> >
> > End If
> > Exit For
> > End If
> > Next
> >
> > Return dc
> > End Function
> >
> > The XML is here:
> >
> > <Form>
> > <Content>
> > <Line><Dynamic type="text" id="DateField"/></Line>
> > <Line/>
> > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > <Line/>
> > <Line/>
> > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > <Line/>
> > <Line>We are asking you to please complete the following with regard to
> > your No-Fault file on the above mentioned insured.</Line>
> > <Line/>
> > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > <Line>Essential Services paid: <Dynamic type="text"
> > id="EssentialServicesPaid"/></Line>
> > <Line>Advise if threshold passed: <Dynamic
> > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > id="AdviseThresholdNo"/> No</Line>
> > <Line>Have you conducted an IME at this time? <Dynamic
> > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > type="checkbox" id="ConductedIMENo"/> No</Line>
> > <Line>If not, do you contemplate scheduling one? <Dynamic
> > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> > <Line>We thank you for your cooperation and are enclosing a return envelope
> > for your convenience.</Line>
> > <Line/>
> > <Line>Sincerely,</Line>
> > <Line/>
> > <Line/>
> > <Line/>
> > <Line/>
> > <Line><Dynamic type="text" id="AdjusterName"/></Line>
> > <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> > <Line/>
> > <Line>Claims Department</Line>
> > <Line/>
> > <Line/>
> > <Line>WB-204 (12-99)</Line>
> > </Content>
> > <RequiredData>
> > <Data fieldtype="NowDate" name="DateField"/>
> > <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> > fieldname="CustomAddress1" size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="CustomAddress2"
> > fieldname="CustomAddress2" size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="CustomAddress3"
> > fieldname="CustomAddress3" size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="CustomAddress4"
> > fieldname="CustomAddress4" size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
> > size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="YourInsured"
> > fieldname="YourInsured" size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
> > size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="OurInsured"
> > fieldname="OurInsured" size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="DateOfLoss"
> > fieldname="DateOfLoss" size="30" maxlength="30"/>
> > <Data type="Entry" fieldtype="Text" name="MedicalPaid"
> > fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > <Data type="Entry" fieldtype="Text" name="WageLossPaid"
> > fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > <Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
> > fieldname="EssentialServicesPaid" size="30" maxlength="20"
> > entrytype="Numeric"/>
> > <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
> > fieldname="AdviseThresholdYes"/>
> > <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
> > fieldname="AdviseThresholdNo"/>
> > <Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
> > fieldname="ConductedIMEYes"/>
> > <Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
> > fieldname="ConductedIMENo"/>
> > <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
> > fieldname="ContemplateSchedulingYes"/>
> > <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
> > fieldname="ContemplateSchedulingNo"/>
> > <Data type="Entry" fieldtype="Text" name="NatureOfInjury"
> > fieldname="NatureOfInjury" size="30" maxlength="30"/>
> > <Data type="Merge" fieldtype="Text" name="AdjusterName"
> > fieldname="AdjusterName" size="30" maxlength="30"/>
> > <Data type="Merge" fieldtype="Text" name="AdjusterPhone"
> > fieldname="AdjusterPhone" size="30" maxlength="30"/>
> > </RequiredData>
> > </Form>
> >
> > Any help would be greatly appreciated.
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #6
Joe
Sorry Curt. I really need you to spell this one out....

How would you implment this? In code? In the markup? Both?

The key here is explicitly spelling out each part of the solution that you
are recommending.

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
<repeater>
<placeholder for control>
<placeholder for text for question>
</repeater>

The repeater is bound to the XML list for it's iteration/count

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
I am not following you. Would you be willing to clarify "repeater perhaps?"
How about an example?
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
Repeater perhaps.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:

> Curt,
>
> Since I will have no idea how many controls I am adding for a given page
> (that is determined by the xml), how would I handle the ambiguity of not
> knowing how many placeholders to add?
>
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Curt_C [MVP]" wrote:
>
> > if I read it right you are simply adding the controls to the page, but not
> > specifying where.
> > You may want to look at the placeholder to use to add your controls to.
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "Joe" wrote:
> >
> > > Hello All:
> > >
> > > I am trying to dynamically populate a web page with literal content and
> > > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > > do not appear in the code yet). I read an xml file and, using the values
> > > retrieved from it, determine what text should be displayed and which controls
> > > should be rendered and - most importantly - where those controls should be
> > > rendered.
> > >
> > > The ultimate goal is to have some text followed by a control that will
> > > capture the users response and post it back to the server. For example the
> > > page might show:
> > >
> > > Please enter the dollar amount: [textbox goes here].
> > > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> > >
> > > The problem is that all of the controls are rendered at the top of the page
> > > and all of the text renders after the closing html tag. I don't know why
> > > this is and I don't know enough about the Render method to speak
> > > intelligently about it. I hope that I have explained clearly what I am
> > > trying to do. If not please let me know.
> > >
> > > The code is here:
> > >
> > > Structure DynamicControl
> > > Dim Type As String
> > > Dim FieldType As String
> > > Dim Name As String
> > > Dim FieldName As String
> > > Dim Size As String
> > > Dim MaxLength As String
> > > Dim EntryType As String
> > > End Structure
> > >
> > > Private doc As XmlDocument
> > > Private Lines As XmlNodeList
> > > Private ReqData As XmlNodeList
> > >
> > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > System.EventArgs) Handles MyBase.Load
> > >
> > > Response.BufferOutput = True
> > > Dim Line As XmlNode
> > > Dim ChildNode As XmlNode
> > > Dim DynamicEntry As XmlNode
> > >
> > > output = New HtmlTextWriter(txtWtr)
> > >
> > > doc = New XmlDocument
> > > doc.Load("C:\SampleForm.xml")
> > >
> > > Lines = doc.GetElementsByTagName("Line")
> > > ReqData = doc.GetElementsByTagName("Data")
> > >
> > > For Each Line In Lines
> > > If Line.HasChildNodes Then
> > > For Each ChildNode In Line.ChildNodes
> > > Dim attrList As XmlAttributeCollection =
> > > ChildNode.Attributes
> > > If Not (attrList Is Nothing) Then
> > > Dim DynCtl As DynamicControl =
> > > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> > >
> > > Select Case DynCtl.FieldType.ToLower
> > > Case "checkbox"
> > > Dim c As CheckBox = New CheckBox
> > > c.ID = attrList.GetNamedItem("id").Value
> > > c.Text = DynCtl.Name
> > > Me.Controls(1).Controls.Add(c)
> > >
> > > Case "text"
> > > Dim t As TextBox = New TextBox
> > > t.ID = attrList.GetNamedItem("id").Value
> > > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > > t.Text = DynCtl.Name
> > > Me.Controls(1).Controls.Add(t)
> > >
> > > End Select
> > > Else
> > > Dim lit As Literal = New Literal
> > > lit.Text = Line.InnerText & "<br/>"
> > > Me.Controls.Add(lit)
> > > End If
> > > Next
> > > Else
> > > Dim lit As Literal = New Literal
> > > lit.Text = Line.InnerText & "<br/>"
> > > Me.Controls.Add(lit)
> > > End If
> > > Next
> > > End Sub
> > >
> > > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > > DynamicControl
> > > Dim DataNode As XmlNode
> > > Dim dc As DynamicControl
> > >
> > > For Each DataNode In ReqData
> > > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > > If dc.FieldType.ToLower = "text" Then
> > > If String.Compare(DataNode.Attributes("type").Value,
> > > "merge") <> 0 Then
> > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > dc.Name = DataNode.Attributes("name").Value
> > > dc.Size = DataNode.Attributes("size").Value
> > > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > > End If
> > >
> > > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > dc.Name = DataNode.Attributes("name").Value
> > >
> > > End If
> > > Exit For
> > > End If
> > > Next
> > >
> > > Return dc
> > > End Function
> > >
> > > The XML is here:
> > >
> > > <Form>
> > > <Content>
> > > <Line><Dynamic type="text" id="DateField"/></Line>
> > > <Line/>
> > > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > > <Line/>
> > > <Line/>
> > > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > > <Line/>
> > > <Line>We are asking you to please complete the following with regard to
> > > your No-Fault file on the above mentioned insured.</Line>
> > > <Line/>
> > > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > > <Line>Essential Services paid: <Dynamic type="text"
> > > id="EssentialServicesPaid"/></Line>
> > > <Line>Advise if threshold passed: <Dynamic
> > > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > > id="AdviseThresholdNo"/> No</Line>
> > > <Line>Have you conducted an IME at this time? <Dynamic
> > > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > > type="checkbox" id="ConductedIMENo"/> No</Line>
> > > <Line>If not, do you contemplate scheduling one? <Dynamic
> > > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> > > <Line>We thank you for your cooperation and are enclosing a return envelope
> > > for your convenience.</Line>
> > > <Line/>
> > > <Line>Sincerely,</Line>
> > > <Line/>
> > > <Line/>
> > > <Line/>
> > > <Line/>
> > > <Line><Dynamic type="text" id="AdjusterName"/></Line>
> > > <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> > > <Line/>
> > > <Line>Claims Department</Line>
> > > <Line/>
> > > <Line/>
> > > <Line>WB-204 (12-99)</Line>
> > > </Content>
> > > <RequiredData>
> > > <Data fieldtype="NowDate" name="DateField"/>
> > > <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> > > fieldname="CustomAddress1" size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="CustomAddress2"
> > > fieldname="CustomAddress2" size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="CustomAddress3"
> > > fieldname="CustomAddress3" size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="CustomAddress4"
> > > fieldname="CustomAddress4" size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
> > > size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="YourInsured"
> > > fieldname="YourInsured" size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
> > > size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="OurInsured"
> > > fieldname="OurInsured" size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="DateOfLoss"
> > > fieldname="DateOfLoss" size="30" maxlength="30"/>
> > > <Data type="Entry" fieldtype="Text" name="MedicalPaid"
> > > fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > > <Data type="Entry" fieldtype="Text" name="WageLossPaid"
> > > fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > > <Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
> > > fieldname="EssentialServicesPaid" size="30" maxlength="20"
> > > entrytype="Numeric"/>
> > > <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
> > > fieldname="AdviseThresholdYes"/>
> > > <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
> > > fieldname="AdviseThresholdNo"/>
> > > <Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
> > > fieldname="ConductedIMEYes"/>
> > > <Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
> > > fieldname="ConductedIMENo"/>
> > > <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
> > > fieldname="ContemplateSchedulingYes"/>
> > > <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
> > > fieldname="ContemplateSchedulingNo"/>
> > > <Data type="Entry" fieldtype="Text" name="NatureOfInjury"
> > > fieldname="NatureOfInjury" size="30" maxlength="30"/>
> > > <Data type="Merge" fieldtype="Text" name="AdjusterName"
> > > fieldname="AdjusterName" size="30" maxlength="30"/>
> > > <Data type="Merge" fieldtype="Text" name="AdjusterPhone"
> > > fieldname="AdjusterPhone" size="30" maxlength="30"/>
> > > </RequiredData>
> > > </Form>
> > >
> > > Any help would be greatly appreciated.
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #7
1) Read your XML in, DataSet might be easiest.
2) Bind your repeater to it
3) in the data bound event write your control to the place holder

There are plenty of samples out there of the Repeater, if that's where you
are saying you are stuck...
I'm trying to not write it for you and instead have you try and post the
specific issues/problems that you encounter.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Sorry Curt. I really need you to spell this one out....

How would you implment this? In code? In the markup? Both?

The key here is explicitly spelling out each part of the solution that you
are recommending.

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
<repeater>
<placeholder for control>
<placeholder for text for question>
</repeater>

The repeater is bound to the XML list for it's iteration/count

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
I am not following you. Would you be willing to clarify "repeater perhaps?"
How about an example?
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:

> Repeater perhaps.
>
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "Joe" wrote:
>
> > Curt,
> >
> > Since I will have no idea how many controls I am adding for a given page
> > (that is determined by the xml), how would I handle the ambiguity of not
> > knowing how many placeholders to add?
> >
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Curt_C [MVP]" wrote:
> >
> > > if I read it right you are simply adding the controls to the page, but not
> > > specifying where.
> > > You may want to look at the placeholder to use to add your controls to.
> > >
> > > --
> > > Curt Christianson
> > > site: http://www.darkfalz.com
> > > blog: http://blog.darkfalz.com
> > >
> > >
> > >
> > > "Joe" wrote:
> > >
> > > > Hello All:
> > > >
> > > > I am trying to dynamically populate a web page with literal content and
> > > > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > > > do not appear in the code yet). I read an xml file and, using the values
> > > > retrieved from it, determine what text should be displayed and which controls
> > > > should be rendered and - most importantly - where those controls should be
> > > > rendered.
> > > >
> > > > The ultimate goal is to have some text followed by a control that will
> > > > capture the users response and post it back to the server. For example the
> > > > page might show:
> > > >
> > > > Please enter the dollar amount: [textbox goes here].
> > > > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> > > >
> > > > The problem is that all of the controls are rendered at the top of the page
> > > > and all of the text renders after the closing html tag. I don't know why
> > > > this is and I don't know enough about the Render method to speak
> > > > intelligently about it. I hope that I have explained clearly what I am
> > > > trying to do. If not please let me know.
> > > >
> > > > The code is here:
> > > >
> > > > Structure DynamicControl
> > > > Dim Type As String
> > > > Dim FieldType As String
> > > > Dim Name As String
> > > > Dim FieldName As String
> > > > Dim Size As String
> > > > Dim MaxLength As String
> > > > Dim EntryType As String
> > > > End Structure
> > > >
> > > > Private doc As XmlDocument
> > > > Private Lines As XmlNodeList
> > > > Private ReqData As XmlNodeList
> > > >
> > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Load
> > > >
> > > > Response.BufferOutput = True
> > > > Dim Line As XmlNode
> > > > Dim ChildNode As XmlNode
> > > > Dim DynamicEntry As XmlNode
> > > >
> > > > output = New HtmlTextWriter(txtWtr)
> > > >
> > > > doc = New XmlDocument
> > > > doc.Load("C:\SampleForm.xml")
> > > >
> > > > Lines = doc.GetElementsByTagName("Line")
> > > > ReqData = doc.GetElementsByTagName("Data")
> > > >
> > > > For Each Line In Lines
> > > > If Line.HasChildNodes Then
> > > > For Each ChildNode In Line.ChildNodes
> > > > Dim attrList As XmlAttributeCollection =
> > > > ChildNode.Attributes
> > > > If Not (attrList Is Nothing) Then
> > > > Dim DynCtl As DynamicControl =
> > > > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> > > >
> > > > Select Case DynCtl.FieldType.ToLower
> > > > Case "checkbox"
> > > > Dim c As CheckBox = New CheckBox
> > > > c.ID = attrList.GetNamedItem("id").Value
> > > > c.Text = DynCtl.Name
> > > > Me.Controls(1).Controls.Add(c)
> > > >
> > > > Case "text"
> > > > Dim t As TextBox = New TextBox
> > > > t.ID = attrList.GetNamedItem("id").Value
> > > > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > > > t.Text = DynCtl.Name
> > > > Me.Controls(1).Controls.Add(t)
> > > >
> > > > End Select
> > > > Else
> > > > Dim lit As Literal = New Literal
> > > > lit.Text = Line.InnerText & "<br/>"
> > > > Me.Controls.Add(lit)
> > > > End If
> > > > Next
> > > > Else
> > > > Dim lit As Literal = New Literal
> > > > lit.Text = Line.InnerText & "<br/>"
> > > > Me.Controls.Add(lit)
> > > > End If
> > > > Next
> > > > End Sub
> > > >
> > > > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > > > DynamicControl
> > > > Dim DataNode As XmlNode
> > > > Dim dc As DynamicControl
> > > >
> > > > For Each DataNode In ReqData
> > > > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > > > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > > > If dc.FieldType.ToLower = "text" Then
> > > > If String.Compare(DataNode.Attributes("type").Value,
> > > > "merge") <> 0 Then
> > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > dc.Name = DataNode.Attributes("name").Value
> > > > dc.Size = DataNode.Attributes("size").Value
> > > > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > > > End If
> > > >
> > > > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > dc.Name = DataNode.Attributes("name").Value
> > > >
> > > > End If
> > > > Exit For
> > > > End If
> > > > Next
> > > >
> > > > Return dc
> > > > End Function
> > > >
> > > > The XML is here:
> > > >
> > > > <Form>
> > > > <Content>
> > > > <Line><Dynamic type="text" id="DateField"/></Line>
> > > > <Line/>
> > > > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > > > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > > > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > > > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > > > <Line/>
> > > > <Line/>
> > > > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > > > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > > > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > > > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > > > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > > > <Line/>
> > > > <Line>We are asking you to please complete the following with regard to
> > > > your No-Fault file on the above mentioned insured.</Line>
> > > > <Line/>
> > > > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > > > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > > > <Line>Essential Services paid: <Dynamic type="text"
> > > > id="EssentialServicesPaid"/></Line>
> > > > <Line>Advise if threshold passed: <Dynamic
> > > > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > > > id="AdviseThresholdNo"/> No</Line>
> > > > <Line>Have you conducted an IME at this time? <Dynamic
> > > > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > > > type="checkbox" id="ConductedIMENo"/> No</Line>
> > > > <Line>If not, do you contemplate scheduling one? <Dynamic
> > > > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > > > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > > > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> > > > <Line>We thank you for your cooperation and are enclosing a return envelope
> > > > for your convenience.</Line>
> > > > <Line/>
> > > > <Line>Sincerely,</Line>
> > > > <Line/>
> > > > <Line/>
> > > > <Line/>
> > > > <Line/>
> > > > <Line><Dynamic type="text" id="AdjusterName"/></Line>
> > > > <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> > > > <Line/>
> > > > <Line>Claims Department</Line>
> > > > <Line/>
> > > > <Line/>
> > > > <Line>WB-204 (12-99)</Line>
> > > > </Content>
> > > > <RequiredData>
> > > > <Data fieldtype="NowDate" name="DateField"/>
> > > > <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> > > > fieldname="CustomAddress1" size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="CustomAddress2"
> > > > fieldname="CustomAddress2" size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="CustomAddress3"
> > > > fieldname="CustomAddress3" size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="CustomAddress4"
> > > > fieldname="CustomAddress4" size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
> > > > size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="YourInsured"
> > > > fieldname="YourInsured" size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
> > > > size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="OurInsured"
> > > > fieldname="OurInsured" size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="DateOfLoss"
> > > > fieldname="DateOfLoss" size="30" maxlength="30"/>
> > > > <Data type="Entry" fieldtype="Text" name="MedicalPaid"
> > > > fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > > > <Data type="Entry" fieldtype="Text" name="WageLossPaid"
> > > > fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > > > <Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
> > > > fieldname="EssentialServicesPaid" size="30" maxlength="20"
> > > > entrytype="Numeric"/>
> > > > <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
> > > > fieldname="AdviseThresholdYes"/>
> > > > <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
> > > > fieldname="AdviseThresholdNo"/>
> > > > <Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
> > > > fieldname="ConductedIMEYes"/>
> > > > <Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
> > > > fieldname="ConductedIMENo"/>
> > > > <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
> > > > fieldname="ContemplateSchedulingYes"/>
> > > > <Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
> > > > fieldname="ContemplateSchedulingNo"/>
> > > > <Data type="Entry" fieldtype="Text" name="NatureOfInjury"
> > > > fieldname="NatureOfInjury" size="30" maxlength="30"/>
> > > > <Data type="Merge" fieldtype="Text" name="AdjusterName"
> > > > fieldname="AdjusterName" size="30" maxlength="30"/>
> > > > <Data type="Merge" fieldtype="Text" name="AdjusterPhone"
> > > > fieldname="AdjusterPhone" size="30" maxlength="30"/>
> > > > </RequiredData>
> > > > </Form>

Nov 19 '05 #8
Joe
Curt,

The issue is that I have never used a placeholder before. I have no
experience with them. That's why I am asking for an example.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
1) Read your XML in, DataSet might be easiest.
2) Bind your repeater to it
3) in the data bound event write your control to the place holder

There are plenty of samples out there of the Repeater, if that's where you
are saying you are stuck...
I'm trying to not write it for you and instead have you try and post the
specific issues/problems that you encounter.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Sorry Curt. I really need you to spell this one out....

How would you implment this? In code? In the markup? Both?

The key here is explicitly spelling out each part of the solution that you
are recommending.

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
<repeater>
<placeholder for control>
<placeholder for text for question>
</repeater>

The repeater is bound to the XML list for it's iteration/count

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:

> I am not following you. Would you be willing to clarify "repeater perhaps?"
> How about an example?
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Curt_C [MVP]" wrote:
>
> > Repeater perhaps.
> >
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "Joe" wrote:
> >
> > > Curt,
> > >
> > > Since I will have no idea how many controls I am adding for a given page
> > > (that is determined by the xml), how would I handle the ambiguity of not
> > > knowing how many placeholders to add?
> > >
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Curt_C [MVP]" wrote:
> > >
> > > > if I read it right you are simply adding the controls to the page, but not
> > > > specifying where.
> > > > You may want to look at the placeholder to use to add your controls to.
> > > >
> > > > --
> > > > Curt Christianson
> > > > site: http://www.darkfalz.com
> > > > blog: http://blog.darkfalz.com
> > > >
> > > >
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > Hello All:
> > > > >
> > > > > I am trying to dynamically populate a web page with literal content and
> > > > > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > > > > do not appear in the code yet). I read an xml file and, using the values
> > > > > retrieved from it, determine what text should be displayed and which controls
> > > > > should be rendered and - most importantly - where those controls should be
> > > > > rendered.
> > > > >
> > > > > The ultimate goal is to have some text followed by a control that will
> > > > > capture the users response and post it back to the server. For example the
> > > > > page might show:
> > > > >
> > > > > Please enter the dollar amount: [textbox goes here].
> > > > > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> > > > >
> > > > > The problem is that all of the controls are rendered at the top of the page
> > > > > and all of the text renders after the closing html tag. I don't know why
> > > > > this is and I don't know enough about the Render method to speak
> > > > > intelligently about it. I hope that I have explained clearly what I am
> > > > > trying to do. If not please let me know.
> > > > >
> > > > > The code is here:
> > > > >
> > > > > Structure DynamicControl
> > > > > Dim Type As String
> > > > > Dim FieldType As String
> > > > > Dim Name As String
> > > > > Dim FieldName As String
> > > > > Dim Size As String
> > > > > Dim MaxLength As String
> > > > > Dim EntryType As String
> > > > > End Structure
> > > > >
> > > > > Private doc As XmlDocument
> > > > > Private Lines As XmlNodeList
> > > > > Private ReqData As XmlNodeList
> > > > >
> > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > > System.EventArgs) Handles MyBase.Load
> > > > >
> > > > > Response.BufferOutput = True
> > > > > Dim Line As XmlNode
> > > > > Dim ChildNode As XmlNode
> > > > > Dim DynamicEntry As XmlNode
> > > > >
> > > > > output = New HtmlTextWriter(txtWtr)
> > > > >
> > > > > doc = New XmlDocument
> > > > > doc.Load("C:\SampleForm.xml")
> > > > >
> > > > > Lines = doc.GetElementsByTagName("Line")
> > > > > ReqData = doc.GetElementsByTagName("Data")
> > > > >
> > > > > For Each Line In Lines
> > > > > If Line.HasChildNodes Then
> > > > > For Each ChildNode In Line.ChildNodes
> > > > > Dim attrList As XmlAttributeCollection =
> > > > > ChildNode.Attributes
> > > > > If Not (attrList Is Nothing) Then
> > > > > Dim DynCtl As DynamicControl =
> > > > > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> > > > >
> > > > > Select Case DynCtl.FieldType.ToLower
> > > > > Case "checkbox"
> > > > > Dim c As CheckBox = New CheckBox
> > > > > c.ID = attrList.GetNamedItem("id").Value
> > > > > c.Text = DynCtl.Name
> > > > > Me.Controls(1).Controls.Add(c)
> > > > >
> > > > > Case "text"
> > > > > Dim t As TextBox = New TextBox
> > > > > t.ID = attrList.GetNamedItem("id").Value
> > > > > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > > > > t.Text = DynCtl.Name
> > > > > Me.Controls(1).Controls.Add(t)
> > > > >
> > > > > End Select
> > > > > Else
> > > > > Dim lit As Literal = New Literal
> > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > Me.Controls.Add(lit)
> > > > > End If
> > > > > Next
> > > > > Else
> > > > > Dim lit As Literal = New Literal
> > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > Me.Controls.Add(lit)
> > > > > End If
> > > > > Next
> > > > > End Sub
> > > > >
> > > > > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > > > > DynamicControl
> > > > > Dim DataNode As XmlNode
> > > > > Dim dc As DynamicControl
> > > > >
> > > > > For Each DataNode In ReqData
> > > > > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > > > > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > > > > If dc.FieldType.ToLower = "text" Then
> > > > > If String.Compare(DataNode.Attributes("type").Value,
> > > > > "merge") <> 0 Then
> > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > dc.Size = DataNode.Attributes("size").Value
> > > > > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > > > > End If
> > > > >
> > > > > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > dc.Name = DataNode.Attributes("name").Value
> > > > >
> > > > > End If
> > > > > Exit For
> > > > > End If
> > > > > Next
> > > > >
> > > > > Return dc
> > > > > End Function
> > > > >
> > > > > The XML is here:
> > > > >
> > > > > <Form>
> > > > > <Content>
> > > > > <Line><Dynamic type="text" id="DateField"/></Line>
> > > > > <Line/>
> > > > > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > > > > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > > > > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > > > > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > > > > <Line/>
> > > > > <Line/>
> > > > > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > > > > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > > > > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > > > > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > > > > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > > > > <Line/>
> > > > > <Line>We are asking you to please complete the following with regard to
> > > > > your No-Fault file on the above mentioned insured.</Line>
> > > > > <Line/>
> > > > > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > > > > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > > > > <Line>Essential Services paid: <Dynamic type="text"
> > > > > id="EssentialServicesPaid"/></Line>
> > > > > <Line>Advise if threshold passed: <Dynamic
> > > > > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > > > > id="AdviseThresholdNo"/> No</Line>
> > > > > <Line>Have you conducted an IME at this time? <Dynamic
> > > > > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > > > > type="checkbox" id="ConductedIMENo"/> No</Line>
> > > > > <Line>If not, do you contemplate scheduling one? <Dynamic
> > > > > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > > > > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > > > > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> > > > > <Line>We thank you for your cooperation and are enclosing a return envelope
> > > > > for your convenience.</Line>
> > > > > <Line/>
> > > > > <Line>Sincerely,</Line>
> > > > > <Line/>
> > > > > <Line/>
> > > > > <Line/>
> > > > > <Line/>
> > > > > <Line><Dynamic type="text" id="AdjusterName"/></Line>
> > > > > <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> > > > > <Line/>
> > > > > <Line>Claims Department</Line>
> > > > > <Line/>
> > > > > <Line/>
> > > > > <Line>WB-204 (12-99)</Line>
> > > > > </Content>
> > > > > <RequiredData>
> > > > > <Data fieldtype="NowDate" name="DateField"/>
> > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> > > > > fieldname="CustomAddress1" size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress2"
> > > > > fieldname="CustomAddress2" size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress3"
> > > > > fieldname="CustomAddress3" size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress4"
> > > > > fieldname="CustomAddress4" size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
> > > > > size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="YourInsured"
> > > > > fieldname="YourInsured" size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
> > > > > size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="OurInsured"
> > > > > fieldname="OurInsured" size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="DateOfLoss"
> > > > > fieldname="DateOfLoss" size="30" maxlength="30"/>
> > > > > <Data type="Entry" fieldtype="Text" name="MedicalPaid"
> > > > > fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > > > > <Data type="Entry" fieldtype="Text" name="WageLossPaid"
> > > > > fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
> > > > > <Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
> > > > > fieldname="EssentialServicesPaid" size="30" maxlength="20"
> > > > > entrytype="Numeric"/>
> > > > > <Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
> > > > > fieldname="AdviseThresholdYes"/>

Nov 19 '05 #9
http://aspnet.4guysfromrolla.com/articles/081402-1.aspx
http://www.devx.com/codemag/Article/20144/0/page/2

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Curt,

The issue is that I have never used a placeholder before. I have no
experience with them. That's why I am asking for an example.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
1) Read your XML in, DataSet might be easiest.
2) Bind your repeater to it
3) in the data bound event write your control to the place holder

There are plenty of samples out there of the Repeater, if that's where you
are saying you are stuck...
I'm trying to not write it for you and instead have you try and post the
specific issues/problems that you encounter.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Sorry Curt. I really need you to spell this one out....

How would you implment this? In code? In the markup? Both?

The key here is explicitly spelling out each part of the solution that you
are recommending.

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:

> <repeater>
> <placeholder for control>
> <placeholder for text for question>
> </repeater>
>
> The repeater is bound to the XML list for it's iteration/count
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "Joe" wrote:
>
> > I am not following you. Would you be willing to clarify "repeater perhaps?"
> > How about an example?
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Curt_C [MVP]" wrote:
> >
> > > Repeater perhaps.
> > >
> > >
> > > --
> > > Curt Christianson
> > > site: http://www.darkfalz.com
> > > blog: http://blog.darkfalz.com
> > >
> > >
> > >
> > > "Joe" wrote:
> > >
> > > > Curt,
> > > >
> > > > Since I will have no idea how many controls I am adding for a given page
> > > > (that is determined by the xml), how would I handle the ambiguity of not
> > > > knowing how many placeholders to add?
> > > >
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > >
> > > >
> > > > "Curt_C [MVP]" wrote:
> > > >
> > > > > if I read it right you are simply adding the controls to the page, but not
> > > > > specifying where.
> > > > > You may want to look at the placeholder to use to add your controls to.
> > > > >
> > > > > --
> > > > > Curt Christianson
> > > > > site: http://www.darkfalz.com
> > > > > blog: http://blog.darkfalz.com
> > > > >
> > > > >
> > > > >
> > > > > "Joe" wrote:
> > > > >
> > > > > > Hello All:
> > > > > >
> > > > > > I am trying to dynamically populate a web page with literal content and
> > > > > > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > > > > > do not appear in the code yet). I read an xml file and, using the values
> > > > > > retrieved from it, determine what text should be displayed and which controls
> > > > > > should be rendered and - most importantly - where those controls should be
> > > > > > rendered.
> > > > > >
> > > > > > The ultimate goal is to have some text followed by a control that will
> > > > > > capture the users response and post it back to the server. For example the
> > > > > > page might show:
> > > > > >
> > > > > > Please enter the dollar amount: [textbox goes here].
> > > > > > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> > > > > >
> > > > > > The problem is that all of the controls are rendered at the top of the page
> > > > > > and all of the text renders after the closing html tag. I don't know why
> > > > > > this is and I don't know enough about the Render method to speak
> > > > > > intelligently about it. I hope that I have explained clearly what I am
> > > > > > trying to do. If not please let me know.
> > > > > >
> > > > > > The code is here:
> > > > > >
> > > > > > Structure DynamicControl
> > > > > > Dim Type As String
> > > > > > Dim FieldType As String
> > > > > > Dim Name As String
> > > > > > Dim FieldName As String
> > > > > > Dim Size As String
> > > > > > Dim MaxLength As String
> > > > > > Dim EntryType As String
> > > > > > End Structure
> > > > > >
> > > > > > Private doc As XmlDocument
> > > > > > Private Lines As XmlNodeList
> > > > > > Private ReqData As XmlNodeList
> > > > > >
> > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > > > System.EventArgs) Handles MyBase.Load
> > > > > >
> > > > > > Response.BufferOutput = True
> > > > > > Dim Line As XmlNode
> > > > > > Dim ChildNode As XmlNode
> > > > > > Dim DynamicEntry As XmlNode
> > > > > >
> > > > > > output = New HtmlTextWriter(txtWtr)
> > > > > >
> > > > > > doc = New XmlDocument
> > > > > > doc.Load("C:\SampleForm.xml")
> > > > > >
> > > > > > Lines = doc.GetElementsByTagName("Line")
> > > > > > ReqData = doc.GetElementsByTagName("Data")
> > > > > >
> > > > > > For Each Line In Lines
> > > > > > If Line.HasChildNodes Then
> > > > > > For Each ChildNode In Line.ChildNodes
> > > > > > Dim attrList As XmlAttributeCollection =
> > > > > > ChildNode.Attributes
> > > > > > If Not (attrList Is Nothing) Then
> > > > > > Dim DynCtl As DynamicControl =
> > > > > > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> > > > > >
> > > > > > Select Case DynCtl.FieldType.ToLower
> > > > > > Case "checkbox"
> > > > > > Dim c As CheckBox = New CheckBox
> > > > > > c.ID = attrList.GetNamedItem("id").Value
> > > > > > c.Text = DynCtl.Name
> > > > > > Me.Controls(1).Controls.Add(c)
> > > > > >
> > > > > > Case "text"
> > > > > > Dim t As TextBox = New TextBox
> > > > > > t.ID = attrList.GetNamedItem("id").Value
> > > > > > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > > > > > t.Text = DynCtl.Name
> > > > > > Me.Controls(1).Controls.Add(t)
> > > > > >
> > > > > > End Select
> > > > > > Else
> > > > > > Dim lit As Literal = New Literal
> > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > Me.Controls.Add(lit)
> > > > > > End If
> > > > > > Next
> > > > > > Else
> > > > > > Dim lit As Literal = New Literal
> > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > Me.Controls.Add(lit)
> > > > > > End If
> > > > > > Next
> > > > > > End Sub
> > > > > >
> > > > > > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > > > > > DynamicControl
> > > > > > Dim DataNode As XmlNode
> > > > > > Dim dc As DynamicControl
> > > > > >
> > > > > > For Each DataNode In ReqData
> > > > > > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > > > > > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > > > > > If dc.FieldType.ToLower = "text" Then
> > > > > > If String.Compare(DataNode.Attributes("type").Value,
> > > > > > "merge") <> 0 Then
> > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > > dc.Size = DataNode.Attributes("size").Value
> > > > > > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > > > > > End If
> > > > > >
> > > > > > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > >
> > > > > > End If
> > > > > > Exit For
> > > > > > End If
> > > > > > Next
> > > > > >
> > > > > > Return dc
> > > > > > End Function
> > > > > >
> > > > > > The XML is here:
> > > > > >
> > > > > > <Form>
> > > > > > <Content>
> > > > > > <Line><Dynamic type="text" id="DateField"/></Line>
> > > > > > <Line/>
> > > > > > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > > > > > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > > > > > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > > > > > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > > > > > <Line/>
> > > > > > <Line/>
> > > > > > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > > > > > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > > > > > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > > > > > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > > > > > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > > > > > <Line/>
> > > > > > <Line>We are asking you to please complete the following with regard to
> > > > > > your No-Fault file on the above mentioned insured.</Line>
> > > > > > <Line/>
> > > > > > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > > > > > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > > > > > <Line>Essential Services paid: <Dynamic type="text"
> > > > > > id="EssentialServicesPaid"/></Line>
> > > > > > <Line>Advise if threshold passed: <Dynamic
> > > > > > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > > > > > id="AdviseThresholdNo"/> No</Line>
> > > > > > <Line>Have you conducted an IME at this time? <Dynamic
> > > > > > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > > > > > type="checkbox" id="ConductedIMENo"/> No</Line>
> > > > > > <Line>If not, do you contemplate scheduling one? <Dynamic
> > > > > > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > > > > > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > > > > > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> > > > > > <Line>We thank you for your cooperation and are enclosing a return envelope
> > > > > > for your convenience.</Line>
> > > > > > <Line/>
> > > > > > <Line>Sincerely,</Line>
> > > > > > <Line/>
> > > > > > <Line/>
> > > > > > <Line/>
> > > > > > <Line/>
> > > > > > <Line><Dynamic type="text" id="AdjusterName"/></Line>
> > > > > > <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> > > > > > <Line/>
> > > > > > <Line>Claims Department</Line>
> > > > > > <Line/>
> > > > > > <Line/>
> > > > > > <Line>WB-204 (12-99)</Line>
> > > > > > </Content>
> > > > > > <RequiredData>
> > > > > > <Data fieldtype="NowDate" name="DateField"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> > > > > > fieldname="CustomAddress1" size="30" maxlength="30"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress2"
> > > > > > fieldname="CustomAddress2" size="30" maxlength="30"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress3"
> > > > > > fieldname="CustomAddress3" size="30" maxlength="30"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress4"
> > > > > > fieldname="CustomAddress4" size="30" maxlength="30"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
> > > > > > size="30" maxlength="30"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="YourInsured"
> > > > > > fieldname="YourInsured" size="30" maxlength="30"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
> > > > > > size="30" maxlength="30"/>
> > > > > > <Data type="Entry" fieldtype="Text" name="OurInsured"

Nov 19 '05 #10
Joe
Thanks Curt. I've already read these. But they don't solve the problem.
Here's why: I can't statically place "Placeholder" controls on this form. I
have no idea how many I would need or where they should go.

The controls (placehodlers or otherwise) must be dynamically added to the
form. Then they must be dynamically populated. Remember, I do not know what
content or controls will be requried for a given form. That is determined
solely by the XML.

Do you know of any articles that discuss this (dynamically adding
Placeholder controls (to be populated at some later time in the cdoe))?

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
http://aspnet.4guysfromrolla.com/articles/081402-1.aspx
http://www.devx.com/codemag/Article/20144/0/page/2

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Curt,

The issue is that I have never used a placeholder before. I have no
experience with them. That's why I am asking for an example.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
1) Read your XML in, DataSet might be easiest.
2) Bind your repeater to it
3) in the data bound event write your control to the place holder

There are plenty of samples out there of the Repeater, if that's where you
are saying you are stuck...
I'm trying to not write it for you and instead have you try and post the
specific issues/problems that you encounter.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:

> Sorry Curt. I really need you to spell this one out....
>
> How would you implment this? In code? In the markup? Both?
>
> The key here is explicitly spelling out each part of the solution that you
> are recommending.
>
> Thanks,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Curt_C [MVP]" wrote:
>
> > <repeater>
> > <placeholder for control>
> > <placeholder for text for question>
> > </repeater>
> >
> > The repeater is bound to the XML list for it's iteration/count
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "Joe" wrote:
> >
> > > I am not following you. Would you be willing to clarify "repeater perhaps?"
> > > How about an example?
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Curt_C [MVP]" wrote:
> > >
> > > > Repeater perhaps.
> > > >
> > > >
> > > > --
> > > > Curt Christianson
> > > > site: http://www.darkfalz.com
> > > > blog: http://blog.darkfalz.com
> > > >
> > > >
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > Curt,
> > > > >
> > > > > Since I will have no idea how many controls I am adding for a given page
> > > > > (that is determined by the xml), how would I handle the ambiguity of not
> > > > > knowing how many placeholders to add?
> > > > >
> > > > > --
> > > > > Joe
> > > > >
> > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > >
> > > > >
> > > > > "Curt_C [MVP]" wrote:
> > > > >
> > > > > > if I read it right you are simply adding the controls to the page, but not
> > > > > > specifying where.
> > > > > > You may want to look at the placeholder to use to add your controls to.
> > > > > >
> > > > > > --
> > > > > > Curt Christianson
> > > > > > site: http://www.darkfalz.com
> > > > > > blog: http://blog.darkfalz.com
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Joe" wrote:
> > > > > >
> > > > > > > Hello All:
> > > > > > >
> > > > > > > I am trying to dynamically populate a web page with literal content and
> > > > > > > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > > > > > > do not appear in the code yet). I read an xml file and, using the values
> > > > > > > retrieved from it, determine what text should be displayed and which controls
> > > > > > > should be rendered and - most importantly - where those controls should be
> > > > > > > rendered.
> > > > > > >
> > > > > > > The ultimate goal is to have some text followed by a control that will
> > > > > > > capture the users response and post it back to the server. For example the
> > > > > > > page might show:
> > > > > > >
> > > > > > > Please enter the dollar amount: [textbox goes here].
> > > > > > > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> > > > > > >
> > > > > > > The problem is that all of the controls are rendered at the top of the page
> > > > > > > and all of the text renders after the closing html tag. I don't know why
> > > > > > > this is and I don't know enough about the Render method to speak
> > > > > > > intelligently about it. I hope that I have explained clearly what I am
> > > > > > > trying to do. If not please let me know.
> > > > > > >
> > > > > > > The code is here:
> > > > > > >
> > > > > > > Structure DynamicControl
> > > > > > > Dim Type As String
> > > > > > > Dim FieldType As String
> > > > > > > Dim Name As String
> > > > > > > Dim FieldName As String
> > > > > > > Dim Size As String
> > > > > > > Dim MaxLength As String
> > > > > > > Dim EntryType As String
> > > > > > > End Structure
> > > > > > >
> > > > > > > Private doc As XmlDocument
> > > > > > > Private Lines As XmlNodeList
> > > > > > > Private ReqData As XmlNodeList
> > > > > > >
> > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > >
> > > > > > > Response.BufferOutput = True
> > > > > > > Dim Line As XmlNode
> > > > > > > Dim ChildNode As XmlNode
> > > > > > > Dim DynamicEntry As XmlNode
> > > > > > >
> > > > > > > output = New HtmlTextWriter(txtWtr)
> > > > > > >
> > > > > > > doc = New XmlDocument
> > > > > > > doc.Load("C:\SampleForm.xml")
> > > > > > >
> > > > > > > Lines = doc.GetElementsByTagName("Line")
> > > > > > > ReqData = doc.GetElementsByTagName("Data")
> > > > > > >
> > > > > > > For Each Line In Lines
> > > > > > > If Line.HasChildNodes Then
> > > > > > > For Each ChildNode In Line.ChildNodes
> > > > > > > Dim attrList As XmlAttributeCollection =
> > > > > > > ChildNode.Attributes
> > > > > > > If Not (attrList Is Nothing) Then
> > > > > > > Dim DynCtl As DynamicControl =
> > > > > > > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> > > > > > >
> > > > > > > Select Case DynCtl.FieldType.ToLower
> > > > > > > Case "checkbox"
> > > > > > > Dim c As CheckBox = New CheckBox
> > > > > > > c.ID = attrList.GetNamedItem("id").Value
> > > > > > > c.Text = DynCtl.Name
> > > > > > > Me.Controls(1).Controls.Add(c)
> > > > > > >
> > > > > > > Case "text"
> > > > > > > Dim t As TextBox = New TextBox
> > > > > > > t.ID = attrList.GetNamedItem("id").Value
> > > > > > > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > > > > > > t.Text = DynCtl.Name
> > > > > > > Me.Controls(1).Controls.Add(t)
> > > > > > >
> > > > > > > End Select
> > > > > > > Else
> > > > > > > Dim lit As Literal = New Literal
> > > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > > Me.Controls.Add(lit)
> > > > > > > End If
> > > > > > > Next
> > > > > > > Else
> > > > > > > Dim lit As Literal = New Literal
> > > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > > Me.Controls.Add(lit)
> > > > > > > End If
> > > > > > > Next
> > > > > > > End Sub
> > > > > > >
> > > > > > > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > > > > > > DynamicControl
> > > > > > > Dim DataNode As XmlNode
> > > > > > > Dim dc As DynamicControl
> > > > > > >
> > > > > > > For Each DataNode In ReqData
> > > > > > > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > > > > > > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > > > > > > If dc.FieldType.ToLower = "text" Then
> > > > > > > If String.Compare(DataNode.Attributes("type").Value,
> > > > > > > "merge") <> 0 Then
> > > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > > > dc.Size = DataNode.Attributes("size").Value
> > > > > > > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > > > > > > End If
> > > > > > >
> > > > > > > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > > >
> > > > > > > End If
> > > > > > > Exit For
> > > > > > > End If
> > > > > > > Next
> > > > > > >
> > > > > > > Return dc
> > > > > > > End Function
> > > > > > >
> > > > > > > The XML is here:
> > > > > > >
> > > > > > > <Form>
> > > > > > > <Content>
> > > > > > > <Line><Dynamic type="text" id="DateField"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > > > > > > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > > > > > > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > > > > > > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > > > > > > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line>We are asking you to please complete the following with regard to
> > > > > > > your No-Fault file on the above mentioned insured.</Line>
> > > > > > > <Line/>
> > > > > > > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > > > > > > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > > > > > > <Line>Essential Services paid: <Dynamic type="text"
> > > > > > > id="EssentialServicesPaid"/></Line>
> > > > > > > <Line>Advise if threshold passed: <Dynamic
> > > > > > > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > > > > > > id="AdviseThresholdNo"/> No</Line>
> > > > > > > <Line>Have you conducted an IME at this time? <Dynamic
> > > > > > > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > > > > > > type="checkbox" id="ConductedIMENo"/> No</Line>
> > > > > > > <Line>If not, do you contemplate scheduling one? <Dynamic
> > > > > > > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > > > > > > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > > > > > > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> > > > > > > <Line>We thank you for your cooperation and are enclosing a return envelope
> > > > > > > for your convenience.</Line>
> > > > > > > <Line/>
> > > > > > > <Line>Sincerely,</Line>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line><Dynamic type="text" id="AdjusterName"/></Line>
> > > > > > > <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line>Claims Department</Line>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line>WB-204 (12-99)</Line>
> > > > > > > </Content>
> > > > > > > <RequiredData>
> > > > > > > <Data fieldtype="NowDate" name="DateField"/>
> > > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> > > > > > > fieldname="CustomAddress1" size="30" maxlength="30"/>
> > > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress2"

Nov 19 '05 #11
that becuase you add controls to

Me.Controls(1).

making them children of the first control on the page, while you add text to

Me.Controls

adding after the last control on the page.
-- bruce (sqlwork.com)
"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:8B**********************************@microsof t.com...
Hello All:

I am trying to dynamically populate a web page with literal content and
controls (textboxes and checkboxes (and eventually two buttons - the
buttons
do not appear in the code yet). I read an xml file and, using the values
retrieved from it, determine what text should be displayed and which
controls
should be rendered and - most importantly - where those controls should be
rendered.

The ultimate goal is to have some text followed by a control that will
capture the users response and post it back to the server. For example the
page might show:

Please enter the dollar amount: [textbox goes here].
Was this an accident? [checkbox for yes] Yes [checkbox for no] No

The problem is that all of the controls are rendered at the top of the
page
and all of the text renders after the closing html tag. I don't know why
this is and I don't know enough about the Render method to speak
intelligently about it. I hope that I have explained clearly what I am
trying to do. If not please let me know.

The code is here:

Structure DynamicControl
Dim Type As String
Dim FieldType As String
Dim Name As String
Dim FieldName As String
Dim Size As String
Dim MaxLength As String
Dim EntryType As String
End Structure

Private doc As XmlDocument
Private Lines As XmlNodeList
Private ReqData As XmlNodeList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.BufferOutput = True
Dim Line As XmlNode
Dim ChildNode As XmlNode
Dim DynamicEntry As XmlNode

output = New HtmlTextWriter(txtWtr)

doc = New XmlDocument
doc.Load("C:\SampleForm.xml")

Lines = doc.GetElementsByTagName("Line")
ReqData = doc.GetElementsByTagName("Data")

For Each Line In Lines
If Line.HasChildNodes Then
For Each ChildNode In Line.ChildNodes
Dim attrList As XmlAttributeCollection =
ChildNode.Attributes
If Not (attrList Is Nothing) Then
Dim DynCtl As DynamicControl =
ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)

Select Case DynCtl.FieldType.ToLower
Case "checkbox"
Dim c As CheckBox = New CheckBox
c.ID = attrList.GetNamedItem("id").Value
c.Text = DynCtl.Name
Me.Controls(1).Controls.Add(c)

Case "text"
Dim t As TextBox = New TextBox
t.ID = attrList.GetNamedItem("id").Value
t.MaxLength = CType(DynCtl.MaxLength,
Integer)
t.Text = DynCtl.Name
Me.Controls(1).Controls.Add(t)

End Select
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
End Sub

Private Function ParseDynamicCtrlData(ByVal id As String) As
DynamicControl
Dim DataNode As XmlNode
Dim dc As DynamicControl

For Each DataNode In ReqData
If String.Compare(DataNode.Attributes("name").Value, id) = 0
Then
dc.FieldType = DataNode.Attributes("fieldtype").Value
If dc.FieldType.ToLower = "text" Then
If String.Compare(DataNode.Attributes("type").Value,
"merge") <> 0 Then
dc.FieldName =
DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value
dc.Size = DataNode.Attributes("size").Value
dc.MaxLength =
DataNode.Attributes("maxlength").Value
End If

ElseIf dc.FieldType.ToLower = "checkbox" Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value

End If
Exit For
End If
Next

Return dc
End Function

The XML is here:

<Form>
<Content>
<Line><Dynamic type="text" id="DateField"/></Line>
<Line/>
<Line><Dynamic type="text" id="CustomAddress1"/></Line>
<Line><Dynamic type="text" id="CustomAddress2"/></Line>
<Line><Dynamic type="text" id="CustomAddress3"/></Line>
<Line><Dynamic type="text" id="CustomAddress4"/></Line>
<Line/>
<Line/>
<Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
<Line> Your Insured: <Dynamic type="text"
id="YourInsured"/></Line>
<Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
<Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
<Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
<Line/>
<Line>We are asking you to please complete the following with regard to
your No-Fault file on the above mentioned insured.</Line>
<Line/>
<Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
<Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
<Line>Essential Services paid: <Dynamic type="text"
id="EssentialServicesPaid"/></Line>
<Line>Advise if threshold passed: <Dynamic
type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
id="AdviseThresholdNo"/> No</Line>
<Line>Have you conducted an IME at this time? <Dynamic
type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
type="checkbox" id="ConductedIMENo"/> No</Line>
<Line>If not, do you contemplate scheduling one? <Dynamic
type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
<Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
<Line>We thank you for your cooperation and are enclosing a return
envelope
for your convenience.</Line>
<Line/>
<Line>Sincerely,</Line>
<Line/>
<Line/>
<Line/>
<Line/>
<Line><Dynamic type="text" id="AdjusterName"/></Line>
<Line><Dynamic type="text" id="AdjusterPhone"/></Line>
<Line/>
<Line>Claims Department</Line>
<Line/>
<Line/>
<Line>WB-204 (12-99)</Line>
</Content>
<RequiredData>
<Data fieldtype="NowDate" name="DateField"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress1"
fieldname="CustomAddress1" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress2"
fieldname="CustomAddress2" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress3"
fieldname="CustomAddress3" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress4"
fieldname="CustomAddress4" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourInsured"
fieldname="YourInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurInsured"
fieldname="OurInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="DateOfLoss"
fieldname="DateOfLoss" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="MedicalPaid"
fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="WageLossPaid"
fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
fieldname="EssentialServicesPaid" size="30" maxlength="20"
entrytype="Numeric"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
fieldname="AdviseThresholdYes"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
fieldname="AdviseThresholdNo"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
fieldname="ConductedIMEYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
fieldname="ConductedIMENo"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
fieldname="ContemplateSchedulingYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
fieldname="ContemplateSchedulingNo"/>
<Data type="Entry" fieldtype="Text" name="NatureOfInjury"
fieldname="NatureOfInjury" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterName"
fieldname="AdjusterName" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterPhone"
fieldname="AdjusterPhone" size="30" maxlength="30"/>
</RequiredData>
</Form>

Any help would be greatly appreciated.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #12
Joe
That's it. Thanks!!!!
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Bruce Barker" wrote:
that becuase you add controls to

Me.Controls(1).

making them children of the first control on the page, while you add text to

Me.Controls

adding after the last control on the page.
-- bruce (sqlwork.com)
"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:8B**********************************@microsof t.com...
Hello All:

I am trying to dynamically populate a web page with literal content and
controls (textboxes and checkboxes (and eventually two buttons - the
buttons
do not appear in the code yet). I read an xml file and, using the values
retrieved from it, determine what text should be displayed and which
controls
should be rendered and - most importantly - where those controls should be
rendered.

The ultimate goal is to have some text followed by a control that will
capture the users response and post it back to the server. For example the
page might show:

Please enter the dollar amount: [textbox goes here].
Was this an accident? [checkbox for yes] Yes [checkbox for no] No

The problem is that all of the controls are rendered at the top of the
page
and all of the text renders after the closing html tag. I don't know why
this is and I don't know enough about the Render method to speak
intelligently about it. I hope that I have explained clearly what I am
trying to do. If not please let me know.

The code is here:

Structure DynamicControl
Dim Type As String
Dim FieldType As String
Dim Name As String
Dim FieldName As String
Dim Size As String
Dim MaxLength As String
Dim EntryType As String
End Structure

Private doc As XmlDocument
Private Lines As XmlNodeList
Private ReqData As XmlNodeList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Response.BufferOutput = True
Dim Line As XmlNode
Dim ChildNode As XmlNode
Dim DynamicEntry As XmlNode

output = New HtmlTextWriter(txtWtr)

doc = New XmlDocument
doc.Load("C:\SampleForm.xml")

Lines = doc.GetElementsByTagName("Line")
ReqData = doc.GetElementsByTagName("Data")

For Each Line In Lines
If Line.HasChildNodes Then
For Each ChildNode In Line.ChildNodes
Dim attrList As XmlAttributeCollection =
ChildNode.Attributes
If Not (attrList Is Nothing) Then
Dim DynCtl As DynamicControl =
ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)

Select Case DynCtl.FieldType.ToLower
Case "checkbox"
Dim c As CheckBox = New CheckBox
c.ID = attrList.GetNamedItem("id").Value
c.Text = DynCtl.Name
Me.Controls(1).Controls.Add(c)

Case "text"
Dim t As TextBox = New TextBox
t.ID = attrList.GetNamedItem("id").Value
t.MaxLength = CType(DynCtl.MaxLength,
Integer)
t.Text = DynCtl.Name
Me.Controls(1).Controls.Add(t)

End Select
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
Else
Dim lit As Literal = New Literal
lit.Text = Line.InnerText & "<br/>"
Me.Controls.Add(lit)
End If
Next
End Sub

Private Function ParseDynamicCtrlData(ByVal id As String) As
DynamicControl
Dim DataNode As XmlNode
Dim dc As DynamicControl

For Each DataNode In ReqData
If String.Compare(DataNode.Attributes("name").Value, id) = 0
Then
dc.FieldType = DataNode.Attributes("fieldtype").Value
If dc.FieldType.ToLower = "text" Then
If String.Compare(DataNode.Attributes("type").Value,
"merge") <> 0 Then
dc.FieldName =
DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value
dc.Size = DataNode.Attributes("size").Value
dc.MaxLength =
DataNode.Attributes("maxlength").Value
End If

ElseIf dc.FieldType.ToLower = "checkbox" Then
dc.FieldName = DataNode.Attributes("fieldname").Value
dc.Name = DataNode.Attributes("name").Value

End If
Exit For
End If
Next

Return dc
End Function

The XML is here:

<Form>
<Content>
<Line><Dynamic type="text" id="DateField"/></Line>
<Line/>
<Line><Dynamic type="text" id="CustomAddress1"/></Line>
<Line><Dynamic type="text" id="CustomAddress2"/></Line>
<Line><Dynamic type="text" id="CustomAddress3"/></Line>
<Line><Dynamic type="text" id="CustomAddress4"/></Line>
<Line/>
<Line/>
<Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
<Line> Your Insured: <Dynamic type="text"
id="YourInsured"/></Line>
<Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
<Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
<Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
<Line/>
<Line>We are asking you to please complete the following with regard to
your No-Fault file on the above mentioned insured.</Line>
<Line/>
<Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
<Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
<Line>Essential Services paid: <Dynamic type="text"
id="EssentialServicesPaid"/></Line>
<Line>Advise if threshold passed: <Dynamic
type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
id="AdviseThresholdNo"/> No</Line>
<Line>Have you conducted an IME at this time? <Dynamic
type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
type="checkbox" id="ConductedIMENo"/> No</Line>
<Line>If not, do you contemplate scheduling one? <Dynamic
type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
<Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
<Line>We thank you for your cooperation and are enclosing a return
envelope
for your convenience.</Line>
<Line/>
<Line>Sincerely,</Line>
<Line/>
<Line/>
<Line/>
<Line/>
<Line><Dynamic type="text" id="AdjusterName"/></Line>
<Line><Dynamic type="text" id="AdjusterPhone"/></Line>
<Line/>
<Line>Claims Department</Line>
<Line/>
<Line/>
<Line>WB-204 (12-99)</Line>
</Content>
<RequiredData>
<Data fieldtype="NowDate" name="DateField"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress1"
fieldname="CustomAddress1" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress2"
fieldname="CustomAddress2" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress3"
fieldname="CustomAddress3" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="CustomAddress4"
fieldname="CustomAddress4" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourFile" fieldname="YourFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="YourInsured"
fieldname="YourInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurFile" fieldname="OurFile"
size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="OurInsured"
fieldname="OurInsured" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="DateOfLoss"
fieldname="DateOfLoss" size="30" maxlength="30"/>
<Data type="Entry" fieldtype="Text" name="MedicalPaid"
fieldname="MedicalPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="WageLossPaid"
fieldname="WageLossPaid" size="30" maxlength="20" entrytype="Numeric"/>
<Data type="Entry" fieldtype="Text" name="EssentialServicesPaid"
fieldname="EssentialServicesPaid" size="30" maxlength="20"
entrytype="Numeric"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdYes"
fieldname="AdviseThresholdYes"/>
<Data type="Entry" fieldtype="Checkbox" name="AdviseThresholdNo"
fieldname="AdviseThresholdNo"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMEYes"
fieldname="ConductedIMEYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ConductedIMENo"
fieldname="ConductedIMENo"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingYes"
fieldname="ContemplateSchedulingYes"/>
<Data type="Entry" fieldtype="Checkbox" name="ContemplateSchedulingNo"
fieldname="ContemplateSchedulingNo"/>
<Data type="Entry" fieldtype="Text" name="NatureOfInjury"
fieldname="NatureOfInjury" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterName"
fieldname="AdjusterName" size="30" maxlength="30"/>
<Data type="Merge" fieldtype="Text" name="AdjusterPhone"
fieldname="AdjusterPhone" size="30" maxlength="30"/>
</RequiredData>
</Form>

Any help would be greatly appreciated.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #13
Joe
Never mind. Can use
Dim plc as Placeholder = new Placeholder
Me.controls(1).controls.add(plc) as needed.

BTW, do you know why the Form is Control(1) and not Control(0)?

TIA. Apprecaite your efforts.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
http://aspnet.4guysfromrolla.com/articles/081402-1.aspx
http://www.devx.com/codemag/Article/20144/0/page/2

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Curt,

The issue is that I have never used a placeholder before. I have no
experience with them. That's why I am asking for an example.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
1) Read your XML in, DataSet might be easiest.
2) Bind your repeater to it
3) in the data bound event write your control to the place holder

There are plenty of samples out there of the Repeater, if that's where you
are saying you are stuck...
I'm trying to not write it for you and instead have you try and post the
specific issues/problems that you encounter.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:

> Sorry Curt. I really need you to spell this one out....
>
> How would you implment this? In code? In the markup? Both?
>
> The key here is explicitly spelling out each part of the solution that you
> are recommending.
>
> Thanks,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>
>
> "Curt_C [MVP]" wrote:
>
> > <repeater>
> > <placeholder for control>
> > <placeholder for text for question>
> > </repeater>
> >
> > The repeater is bound to the XML list for it's iteration/count
> >
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> >
> >
> >
> > "Joe" wrote:
> >
> > > I am not following you. Would you be willing to clarify "repeater perhaps?"
> > > How about an example?
> > > --
> > > Joe
> > >
> > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > >
> > >
> > > "Curt_C [MVP]" wrote:
> > >
> > > > Repeater perhaps.
> > > >
> > > >
> > > > --
> > > > Curt Christianson
> > > > site: http://www.darkfalz.com
> > > > blog: http://blog.darkfalz.com
> > > >
> > > >
> > > >
> > > > "Joe" wrote:
> > > >
> > > > > Curt,
> > > > >
> > > > > Since I will have no idea how many controls I am adding for a given page
> > > > > (that is determined by the xml), how would I handle the ambiguity of not
> > > > > knowing how many placeholders to add?
> > > > >
> > > > > --
> > > > > Joe
> > > > >
> > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > >
> > > > >
> > > > > "Curt_C [MVP]" wrote:
> > > > >
> > > > > > if I read it right you are simply adding the controls to the page, but not
> > > > > > specifying where.
> > > > > > You may want to look at the placeholder to use to add your controls to.
> > > > > >
> > > > > > --
> > > > > > Curt Christianson
> > > > > > site: http://www.darkfalz.com
> > > > > > blog: http://blog.darkfalz.com
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Joe" wrote:
> > > > > >
> > > > > > > Hello All:
> > > > > > >
> > > > > > > I am trying to dynamically populate a web page with literal content and
> > > > > > > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > > > > > > do not appear in the code yet). I read an xml file and, using the values
> > > > > > > retrieved from it, determine what text should be displayed and which controls
> > > > > > > should be rendered and - most importantly - where those controls should be
> > > > > > > rendered.
> > > > > > >
> > > > > > > The ultimate goal is to have some text followed by a control that will
> > > > > > > capture the users response and post it back to the server. For example the
> > > > > > > page might show:
> > > > > > >
> > > > > > > Please enter the dollar amount: [textbox goes here].
> > > > > > > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> > > > > > >
> > > > > > > The problem is that all of the controls are rendered at the top of the page
> > > > > > > and all of the text renders after the closing html tag. I don't know why
> > > > > > > this is and I don't know enough about the Render method to speak
> > > > > > > intelligently about it. I hope that I have explained clearly what I am
> > > > > > > trying to do. If not please let me know.
> > > > > > >
> > > > > > > The code is here:
> > > > > > >
> > > > > > > Structure DynamicControl
> > > > > > > Dim Type As String
> > > > > > > Dim FieldType As String
> > > > > > > Dim Name As String
> > > > > > > Dim FieldName As String
> > > > > > > Dim Size As String
> > > > > > > Dim MaxLength As String
> > > > > > > Dim EntryType As String
> > > > > > > End Structure
> > > > > > >
> > > > > > > Private doc As XmlDocument
> > > > > > > Private Lines As XmlNodeList
> > > > > > > Private ReqData As XmlNodeList
> > > > > > >
> > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > >
> > > > > > > Response.BufferOutput = True
> > > > > > > Dim Line As XmlNode
> > > > > > > Dim ChildNode As XmlNode
> > > > > > > Dim DynamicEntry As XmlNode
> > > > > > >
> > > > > > > output = New HtmlTextWriter(txtWtr)
> > > > > > >
> > > > > > > doc = New XmlDocument
> > > > > > > doc.Load("C:\SampleForm.xml")
> > > > > > >
> > > > > > > Lines = doc.GetElementsByTagName("Line")
> > > > > > > ReqData = doc.GetElementsByTagName("Data")
> > > > > > >
> > > > > > > For Each Line In Lines
> > > > > > > If Line.HasChildNodes Then
> > > > > > > For Each ChildNode In Line.ChildNodes
> > > > > > > Dim attrList As XmlAttributeCollection =
> > > > > > > ChildNode.Attributes
> > > > > > > If Not (attrList Is Nothing) Then
> > > > > > > Dim DynCtl As DynamicControl =
> > > > > > > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> > > > > > >
> > > > > > > Select Case DynCtl.FieldType.ToLower
> > > > > > > Case "checkbox"
> > > > > > > Dim c As CheckBox = New CheckBox
> > > > > > > c.ID = attrList.GetNamedItem("id").Value
> > > > > > > c.Text = DynCtl.Name
> > > > > > > Me.Controls(1).Controls.Add(c)
> > > > > > >
> > > > > > > Case "text"
> > > > > > > Dim t As TextBox = New TextBox
> > > > > > > t.ID = attrList.GetNamedItem("id").Value
> > > > > > > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > > > > > > t.Text = DynCtl.Name
> > > > > > > Me.Controls(1).Controls.Add(t)
> > > > > > >
> > > > > > > End Select
> > > > > > > Else
> > > > > > > Dim lit As Literal = New Literal
> > > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > > Me.Controls.Add(lit)
> > > > > > > End If
> > > > > > > Next
> > > > > > > Else
> > > > > > > Dim lit As Literal = New Literal
> > > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > > Me.Controls.Add(lit)
> > > > > > > End If
> > > > > > > Next
> > > > > > > End Sub
> > > > > > >
> > > > > > > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > > > > > > DynamicControl
> > > > > > > Dim DataNode As XmlNode
> > > > > > > Dim dc As DynamicControl
> > > > > > >
> > > > > > > For Each DataNode In ReqData
> > > > > > > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > > > > > > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > > > > > > If dc.FieldType.ToLower = "text" Then
> > > > > > > If String.Compare(DataNode.Attributes("type").Value,
> > > > > > > "merge") <> 0 Then
> > > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > > > dc.Size = DataNode.Attributes("size").Value
> > > > > > > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > > > > > > End If
> > > > > > >
> > > > > > > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > > >
> > > > > > > End If
> > > > > > > Exit For
> > > > > > > End If
> > > > > > > Next
> > > > > > >
> > > > > > > Return dc
> > > > > > > End Function
> > > > > > >
> > > > > > > The XML is here:
> > > > > > >
> > > > > > > <Form>
> > > > > > > <Content>
> > > > > > > <Line><Dynamic type="text" id="DateField"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > > > > > > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > > > > > > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > > > > > > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > > > > > > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > > > > > > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line>We are asking you to please complete the following with regard to
> > > > > > > your No-Fault file on the above mentioned insured.</Line>
> > > > > > > <Line/>
> > > > > > > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > > > > > > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > > > > > > <Line>Essential Services paid: <Dynamic type="text"
> > > > > > > id="EssentialServicesPaid"/></Line>
> > > > > > > <Line>Advise if threshold passed: <Dynamic
> > > > > > > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > > > > > > id="AdviseThresholdNo"/> No</Line>
> > > > > > > <Line>Have you conducted an IME at this time? <Dynamic
> > > > > > > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > > > > > > type="checkbox" id="ConductedIMENo"/> No</Line>
> > > > > > > <Line>If not, do you contemplate scheduling one? <Dynamic
> > > > > > > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > > > > > > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > > > > > > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>
> > > > > > > <Line>We thank you for your cooperation and are enclosing a return envelope
> > > > > > > for your convenience.</Line>
> > > > > > > <Line/>
> > > > > > > <Line>Sincerely,</Line>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line><Dynamic type="text" id="AdjusterName"/></Line>
> > > > > > > <Line><Dynamic type="text" id="AdjusterPhone"/></Line>
> > > > > > > <Line/>
> > > > > > > <Line>Claims Department</Line>
> > > > > > > <Line/>
> > > > > > > <Line/>
> > > > > > > <Line>WB-204 (12-99)</Line>
> > > > > > > </Content>
> > > > > > > <RequiredData>
> > > > > > > <Data fieldtype="NowDate" name="DateField"/>
> > > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress1"
> > > > > > > fieldname="CustomAddress1" size="30" maxlength="30"/>
> > > > > > > <Data type="Entry" fieldtype="Text" name="CustomAddress2"

Nov 19 '05 #14
That's why I was saying use a Repeater with the PlaceHolder in the
ItemTemplate.
Then it would add (n) number of the Placeholders.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Thanks Curt. I've already read these. But they don't solve the problem.
Here's why: I can't statically place "Placeholder" controls on this form. I
have no idea how many I would need or where they should go.

The controls (placehodlers or otherwise) must be dynamically added to the
form. Then they must be dynamically populated. Remember, I do not know what
content or controls will be requried for a given form. That is determined
solely by the XML.

Do you know of any articles that discuss this (dynamically adding
Placeholder controls (to be populated at some later time in the cdoe))?

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:
http://aspnet.4guysfromrolla.com/articles/081402-1.aspx
http://www.devx.com/codemag/Article/20144/0/page/2

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Joe" wrote:
Curt,

The issue is that I have never used a placeholder before. I have no
experience with them. That's why I am asking for an example.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Curt_C [MVP]" wrote:

> 1) Read your XML in, DataSet might be easiest.
> 2) Bind your repeater to it
> 3) in the data bound event write your control to the place holder
>
> There are plenty of samples out there of the Repeater, if that's where you
> are saying you are stuck...
> I'm trying to not write it for you and instead have you try and post the
> specific issues/problems that you encounter.
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
>
> "Joe" wrote:
>
> > Sorry Curt. I really need you to spell this one out....
> >
> > How would you implment this? In code? In the markup? Both?
> >
> > The key here is explicitly spelling out each part of the solution that you
> > are recommending.
> >
> > Thanks,
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Curt_C [MVP]" wrote:
> >
> > > <repeater>
> > > <placeholder for control>
> > > <placeholder for text for question>
> > > </repeater>
> > >
> > > The repeater is bound to the XML list for it's iteration/count
> > >
> > > --
> > > Curt Christianson
> > > site: http://www.darkfalz.com
> > > blog: http://blog.darkfalz.com
> > >
> > >
> > >
> > > "Joe" wrote:
> > >
> > > > I am not following you. Would you be willing to clarify "repeater perhaps?"
> > > > How about an example?
> > > > --
> > > > Joe
> > > >
> > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > >
> > > >
> > > > "Curt_C [MVP]" wrote:
> > > >
> > > > > Repeater perhaps.
> > > > >
> > > > >
> > > > > --
> > > > > Curt Christianson
> > > > > site: http://www.darkfalz.com
> > > > > blog: http://blog.darkfalz.com
> > > > >
> > > > >
> > > > >
> > > > > "Joe" wrote:
> > > > >
> > > > > > Curt,
> > > > > >
> > > > > > Since I will have no idea how many controls I am adding for a given page
> > > > > > (that is determined by the xml), how would I handle the ambiguity of not
> > > > > > knowing how many placeholders to add?
> > > > > >
> > > > > > --
> > > > > > Joe
> > > > > >
> > > > > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> > > > > >
> > > > > >
> > > > > > "Curt_C [MVP]" wrote:
> > > > > >
> > > > > > > if I read it right you are simply adding the controls to the page, but not
> > > > > > > specifying where.
> > > > > > > You may want to look at the placeholder to use to add your controls to.
> > > > > > >
> > > > > > > --
> > > > > > > Curt Christianson
> > > > > > > site: http://www.darkfalz.com
> > > > > > > blog: http://blog.darkfalz.com
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "Joe" wrote:
> > > > > > >
> > > > > > > > Hello All:
> > > > > > > >
> > > > > > > > I am trying to dynamically populate a web page with literal content and
> > > > > > > > controls (textboxes and checkboxes (and eventually two buttons - the buttons
> > > > > > > > do not appear in the code yet). I read an xml file and, using the values
> > > > > > > > retrieved from it, determine what text should be displayed and which controls
> > > > > > > > should be rendered and - most importantly - where those controls should be
> > > > > > > > rendered.
> > > > > > > >
> > > > > > > > The ultimate goal is to have some text followed by a control that will
> > > > > > > > capture the users response and post it back to the server. For example the
> > > > > > > > page might show:
> > > > > > > >
> > > > > > > > Please enter the dollar amount: [textbox goes here].
> > > > > > > > Was this an accident? [checkbox for yes] Yes [checkbox for no] No
> > > > > > > >
> > > > > > > > The problem is that all of the controls are rendered at the top of the page
> > > > > > > > and all of the text renders after the closing html tag. I don't know why
> > > > > > > > this is and I don't know enough about the Render method to speak
> > > > > > > > intelligently about it. I hope that I have explained clearly what I am
> > > > > > > > trying to do. If not please let me know.
> > > > > > > >
> > > > > > > > The code is here:
> > > > > > > >
> > > > > > > > Structure DynamicControl
> > > > > > > > Dim Type As String
> > > > > > > > Dim FieldType As String
> > > > > > > > Dim Name As String
> > > > > > > > Dim FieldName As String
> > > > > > > > Dim Size As String
> > > > > > > > Dim MaxLength As String
> > > > > > > > Dim EntryType As String
> > > > > > > > End Structure
> > > > > > > >
> > > > > > > > Private doc As XmlDocument
> > > > > > > > Private Lines As XmlNodeList
> > > > > > > > Private ReqData As XmlNodeList
> > > > > > > >
> > > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > >
> > > > > > > > Response.BufferOutput = True
> > > > > > > > Dim Line As XmlNode
> > > > > > > > Dim ChildNode As XmlNode
> > > > > > > > Dim DynamicEntry As XmlNode
> > > > > > > >
> > > > > > > > output = New HtmlTextWriter(txtWtr)
> > > > > > > >
> > > > > > > > doc = New XmlDocument
> > > > > > > > doc.Load("C:\SampleForm.xml")
> > > > > > > >
> > > > > > > > Lines = doc.GetElementsByTagName("Line")
> > > > > > > > ReqData = doc.GetElementsByTagName("Data")
> > > > > > > >
> > > > > > > > For Each Line In Lines
> > > > > > > > If Line.HasChildNodes Then
> > > > > > > > For Each ChildNode In Line.ChildNodes
> > > > > > > > Dim attrList As XmlAttributeCollection =
> > > > > > > > ChildNode.Attributes
> > > > > > > > If Not (attrList Is Nothing) Then
> > > > > > > > Dim DynCtl As DynamicControl =
> > > > > > > > ParseDynamicCtrlData(attrList.GetNamedItem("id").V alue)
> > > > > > > >
> > > > > > > > Select Case DynCtl.FieldType.ToLower
> > > > > > > > Case "checkbox"
> > > > > > > > Dim c As CheckBox = New CheckBox
> > > > > > > > c.ID = attrList.GetNamedItem("id").Value
> > > > > > > > c.Text = DynCtl.Name
> > > > > > > > Me.Controls(1).Controls.Add(c)
> > > > > > > >
> > > > > > > > Case "text"
> > > > > > > > Dim t As TextBox = New TextBox
> > > > > > > > t.ID = attrList.GetNamedItem("id").Value
> > > > > > > > t.MaxLength = CType(DynCtl.MaxLength, Integer)
> > > > > > > > t.Text = DynCtl.Name
> > > > > > > > Me.Controls(1).Controls.Add(t)
> > > > > > > >
> > > > > > > > End Select
> > > > > > > > Else
> > > > > > > > Dim lit As Literal = New Literal
> > > > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > > > Me.Controls.Add(lit)
> > > > > > > > End If
> > > > > > > > Next
> > > > > > > > Else
> > > > > > > > Dim lit As Literal = New Literal
> > > > > > > > lit.Text = Line.InnerText & "<br/>"
> > > > > > > > Me.Controls.Add(lit)
> > > > > > > > End If
> > > > > > > > Next
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > > Private Function ParseDynamicCtrlData(ByVal id As String) As
> > > > > > > > DynamicControl
> > > > > > > > Dim DataNode As XmlNode
> > > > > > > > Dim dc As DynamicControl
> > > > > > > >
> > > > > > > > For Each DataNode In ReqData
> > > > > > > > If String.Compare(DataNode.Attributes("name").Value, id) = 0 Then
> > > > > > > > dc.FieldType = DataNode.Attributes("fieldtype").Value
> > > > > > > > If dc.FieldType.ToLower = "text" Then
> > > > > > > > If String.Compare(DataNode.Attributes("type").Value,
> > > > > > > > "merge") <> 0 Then
> > > > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > > > > dc.Size = DataNode.Attributes("size").Value
> > > > > > > > dc.MaxLength = DataNode.Attributes("maxlength").Value
> > > > > > > > End If
> > > > > > > >
> > > > > > > > ElseIf dc.FieldType.ToLower = "checkbox" Then
> > > > > > > > dc.FieldName = DataNode.Attributes("fieldname").Value
> > > > > > > > dc.Name = DataNode.Attributes("name").Value
> > > > > > > >
> > > > > > > > End If
> > > > > > > > Exit For
> > > > > > > > End If
> > > > > > > > Next
> > > > > > > >
> > > > > > > > Return dc
> > > > > > > > End Function
> > > > > > > >
> > > > > > > > The XML is here:
> > > > > > > >
> > > > > > > > <Form>
> > > > > > > > <Content>
> > > > > > > > <Line><Dynamic type="text" id="DateField"/></Line>
> > > > > > > > <Line/>
> > > > > > > > <Line><Dynamic type="text" id="CustomAddress1"/></Line>
> > > > > > > > <Line><Dynamic type="text" id="CustomAddress2"/></Line>
> > > > > > > > <Line><Dynamic type="text" id="CustomAddress3"/></Line>
> > > > > > > > <Line><Dynamic type="text" id="CustomAddress4"/></Line>
> > > > > > > > <Line/>
> > > > > > > > <Line/>
> > > > > > > > <Line>RE: Your File #: <Dynamic type="text" id="YourFile"/></Line>
> > > > > > > > <Line> Your Insured: <Dynamic type="text" id="YourInsured"/></Line>
> > > > > > > > <Line> Our File #: <Dynamic type="text" id="OurFile"/></Line>
> > > > > > > > <Line> Our Insured: <Dynamic type="text" id="OurInsured"/></Line>
> > > > > > > > <Line> Date of Loss: <Dynamic type="text" id="DateOfLoss"/></Line>
> > > > > > > > <Line/>
> > > > > > > > <Line>We are asking you to please complete the following with regard to
> > > > > > > > your No-Fault file on the above mentioned insured.</Line>
> > > > > > > > <Line/>
> > > > > > > > <Line>Medical paid: <Dynamic type="text" id="MedicalPaid"/></Line>
> > > > > > > > <Line>Wage Loss paid: <Dynamic type="text" id="WageLossPaid"/></Line>
> > > > > > > > <Line>Essential Services paid: <Dynamic type="text"
> > > > > > > > id="EssentialServicesPaid"/></Line>
> > > > > > > > <Line>Advise if threshold passed: <Dynamic
> > > > > > > > type="checkbox" id="AdviseThresholdYes"/> Yes <Dynamic type="checkbox"
> > > > > > > > id="AdviseThresholdNo"/> No</Line>
> > > > > > > > <Line>Have you conducted an IME at this time? <Dynamic
> > > > > > > > type="checkbox" id="ConductedIMEYes"/> Yes <Dynamic
> > > > > > > > type="checkbox" id="ConductedIMENo"/> No</Line>
> > > > > > > > <Line>If not, do you contemplate scheduling one? <Dynamic
> > > > > > > > type="checkbox" id="ContemplateSchedulingYes"/> Yes <Dynamic
> > > > > > > > type="checkbox" id="ContemplateSchedulingNo"/> No</Line>
> > > > > > > > <Line>Nature of injury <Dynamic type="text" id="NatureOfInjury"/></Line>

Nov 19 '05 #15

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

Similar topics

5
by: Sue | last post by:
On code-behind page: (attributes set programatically for each of these elements) linkbutton added to tablecell textbox added to tablecell tablecells added to tablerow tablerow added to table...
4
by: V. Jenks | last post by:
What seems like a simple thing is apparently not so straightforward? I have a datalist. Inside of that datalist is an <itemtemplate> secion which contains other server controls such as a...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
5
by: Dave A | last post by:
I am writing an ASP.NET tool that will allow the client to create their own online froms. ie the client can add tect boxes, text, drop downs,etc with absolutely no technical skill what so ever....
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
4
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.