<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TEST_TRANSLATION.aspx.vb" Inherits="TEST_TRANSATION" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" Locale="it-IT">
</ext:ResourceManager>
<ext:Hidden ID="CaricaRichiesta" runat="server" Text=""></ext:Hidden>
<ext:Button runat="server" ID="Avvia" Text="Carica Campo">
<DirectEvents>
<Click OnEvent="Carica"></Click>
</DirectEvents>
</ext:Button>
<ext:Panel runat="server" ID="esterno">
<Items>
<ext:FormPanel ButtonAlign="Left" ID="FormPanelRichiesta" runat="server" Title="FORM" BodyStyle="padding:5px;" Frame="false" AutoHeight="true" Border="false">
<Items>
</Items>
</ext:FormPanel>
</Items>
</ext:Panel>
</form>
</body>
</html>
parte vb
Imports Ext.Net
Partial Class TEST_TRANSATION
Inherits System.Web.UI.Page
Protected Sub TEST_TRANSATION_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If CaricaRichiesta.Text = "S" Then
CaricaCampo(False)
End If
End Sub
Private Function CreaLabelObbligatorio(ByVal Obbligatorio As Boolean) As Ext.Net.Label
Dim lblObbligatorio As New Ext.Net.Label
lblObbligatorio.StyleSpec = "font-weight: bold; color:red; width:10px;"
If Obbligatorio Then lblObbligatorio.Text = "*"
Return lblObbligatorio
End Function
Private Function CreaEtichetta(ByVal ID As String, ByVal Etichetta As String) As Ext.Net.Label
Dim lblEtichetta As New Ext.Net.Label
If Etichetta <> "" Then Etichetta = Etichetta & ":"
lblEtichetta.ID = "Etichetta_" & ID
lblEtichetta.Text = Etichetta
lblEtichetta.Width = 130
Return lblEtichetta
End Function
Private Function CreaDaValidare() As Ext.Net.CompositeField
Dim CompField As New Ext.Net.CompositeField
CompField.ID = "CompFieldDaValidare"
CompField.AnchorHorizontal = "100%"
CompField.HideLabel = "true"
CompField.LabelWidth = "0"
CompField.Items.Add(CreaEtichetta("Checkbox", "Test Checkbox"))
CompField.Items.Add(CreaLabelObbligatorio(True))
Dim chkDaValidare As New Ext.Net.CheckboxGroup
chkDaValidare.ID = "chkDaValidare"
chkDaValidare.ColumnsNumber = "1"
chkDaValidare.Width = "100"
Dim chkValida As New Ext.Net.Checkbox
chkValida.ID = "chkValida"
chkValida.BoxLabel = "LINGUA ITALIANO"
chkValida.Checked = True
chkDaValidare.Items.Add(chkValida)
CompField.Items.Add(chkDaValidare)
Return CompField
End Function
Private Sub CaricaCampo(Optional ByVal Render As Boolean = True)
Dim Pannello As Ext.Net.CompositeField = CreaDaValidare()
If IsNothing(Pannello) Then Exit Sub
Pannello.AutoHeight = False
Pannello.AutoWidth = False
FormPanelRichiesta.Add(Pannello)
If Render Then
Cambia()
Pannello.Render()
CaricaRichiesta.Text = "N"
Else
CaricaRichiesta.Text = "S"
End If
End Sub
Protected Sub Carica(sender As Object, e As System.EventArgs) Handles Avvia.Click
CaricaCampo(True)
End Sub
Private Sub Cambia()
Dim OBJ As Object = FormPanelRichiesta.FindControl("chkValida")
If Not IsNothing(OBJ) Then
OBJ.boxLabel = "LINGUA INGLESE"
End If
End Sub
End Class