PDA

View Full Version : Convert FormPanel from Html-Code to VB.Net Code



stephan1985
Jan 24, 2010, 9:39 AM
Hello,

I try to set a FormPanel dynamicly and would like to convert this FormPanel HTML-Code to VB.Net Code. I need also the ASP:Panel in the code below!

Could anybody help me to convert the Html-Code to VB.Net Code, please?

Thanks, a lot!
Stephan



<ext:FormPanel ID="FormPanel" runat="server" BodyStyle="padding:5px;" ButtonAlign="Right">
<Body>
<ext:FormLayout ID="FormLayout" runat="server">
<ext:Anchor Horizontal="100%">
<ext:TextField ID="Description" DataIndex="Description" FieldLabel="Description" runat="server"
ReadOnly="true" />
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:FormPanel>





'SEARCH MAIN ELEMENT
Dim targetRootElement As System.Web.UI.Control
targetRootElement = Me.FindControl("vpMain")



Dim pnl = New Panel()
pnl.ID = "pnlTargetsMain_" &amp; dr("Id").ToString()


'SET NEW ASP:PANEL ELEMENT
If (targetRootElement.FindControl(pnl.ID) Is Nothing) Then
targetRootElement.Controls.Add(pnl)
End If



'SET NEW TARGETROOTELEMENT
targetRootElement = Me.FindControl("pnlTargetsMain_" &amp; dr("Id").ToString()


Dim Coolitepnl = New Coolite.Ext.Web.Panel()
Coolitepnl.ID = "Coolitepnl_" &amp; dr("Id").ToString()


Dim formpnl = New Coolite.Ext.Web.FormPanel()
formpnl.ID = "FormPanel_" &amp; dr("Id").ToString()



Dim formlayout = New Coolite.Ext.Web.FormLayout()
formlayout.ID = "FormLayout_" &amp; dr("Id").ToString


Dim Description = New Coolite.Ext.Web.TextField()
Description.ID = "Description_" &amp; dr("Id").ToString()
Description.AutoWidth = True
Description.DataIndex = "Description"
Description.FieldLabel = "Description"
Description.ReadOnly = True


formlayout.Anchors.Add(Description)
formpnl.Controls.Add(formlayout)
Coolitepnl.Controls.Add(formpnl)
pnl.Controls.Add(Coolitepnl)

stephan1985
Jan 27, 2010, 3:47 PM
I find the solution. I must change the property Controls to BodyControls.