| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
=?Utf-8?B?Q3VydF9DIFtNVlBd?=
Guest
Posts: n/a
|
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").Value) > > 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 |
|
||
|
||||
|
|
|
| |
|
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
|
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").Value) > > > > 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 |
|
||
|
||||
|
=?Utf-8?B?Q3VydF9DIFtNVlBd?=
Guest
Posts: n/a
|
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").Value) > > > > > > 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 |
|
||
|
||||
|
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
|
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").Value) > > > > > > > > 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 |
|
||
|
||||
|
=?Utf-8?B?Q3VydF9DIFtNVlBd?=
Guest
Posts: n/a
|
<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").Value) > > > > > > > > > > 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 |
|
||
|
||||
|
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
|
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").Value) > > > > > > > > > > > > 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 |
|
||
|
||||
|
=?Utf-8?B?Q3VydF9DIFtNVlBd?=
Guest
Posts: n/a
|
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").Value) > > > > > > > > > > > > > > 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> |
|
||
|
||||
|
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
|
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").Value) > > > > > > > > > > > > > > > > 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"/> |
|
||
|
||||
|
=?Utf-8?B?Q3VydF9DIFtNVlBd?=
Guest
Posts: n/a
|
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").Value) > > > > > > > > > > > > > > > > > > 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" |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Where to generate literal controls | Scott M. | Microsoft ASP .NET | 4 | 14th Jul 2008 01:23 PM |
| Weird Literal rendering behavior | Scott L | Microsoft C# .NET | 2 | 20th Mar 2008 09:06 AM |
| Literal control rendering empty | paul.hester@gmail.com | Microsoft Dot NET | 5 | 1st Aug 2006 11:20 PM |
| Literal control rendering empty | Paul | Microsoft ASP .NET | 2 | 31st Jul 2006 04:09 AM |
| IE6 SP1 rendering vs IE6 SP2 rendering | Peter Mount | Windows XP Internet Explorer | 0 | 30th Jan 2006 11:07 AM |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc. |




