How to convert this ?

  • Thread starter Stan Sainte-Rose
  • Start date
S

Stan Sainte-Rose

Oopps sorry for the previous post.
As I said, I m trying to make a web custom control and I do know how I have
to convert
this part to for the render section

In fact it may be a stupid question, how to "ouput" this section
Table1 = CType(S_TABLES(S_IdAnnee), System.Web.UI.WebControls.Table)
Table1.Visible = True

Stan

Here's the code

Private Sub ThingToDisplay
Dim I As Integer
Dim Paragraphe As String
Dim Row, Row1 As DataRow
Dim Tableau As New System.Web.UI.WebControls.Table
Dim Ligne As New System.Web.UI.WebControls.TableRow
Dim cell1 As New System.Web.UI.WebControls.TableCell
Dim cell2 As New System.Web.UI.WebControls.TableCell
Dim cell3 As New System.Web.UI.WebControls.TableCell
S_DataSet.Tables.Add("QUESTIONS")
daQUESTIONS.SelectCommand = SQL_LISTE_QUESTIONS(S_Langue, S_IdPays,
S_IdChapitre, S_IdSchapitre)
daQUESTIONS.Fill(S_DataSet.Tables("QUESTIONS"))
With S_DataSet.Tables.Add("REPONSES_SPE")
.Columns.Add("idquestion", GetType(Integer))
For I = 1993 To 2008
.Columns.Add("V" & I.ToString, GetType(String))
Next
.PrimaryKey = New DataColumn() {.Columns("idquestion")}
End With

daREPONSES_SPE.SelectCommand = SQL_LISTE_REPONSES_SPE(S_IdPays,
S_IdChapitre, S_IdSchapitre)
daREPONSES_SPE.Fill(S_DataSet.Tables("REPONSES_SPE"))
With S_DataSet.Tables.Add("REPONSES")
.Columns.Add("idquestion", GetType(Integer))
For I = 1993 To 2008
.Columns.Add("A" & I.ToString, GetType(Decimal))
.Columns.Add("S" & I.ToString, GetType(String))
Next
.PrimaryKey = New DataColumn() {.Columns("idquestion")}
End With
daREPONSES.SelectCommand = SQL_LISTE_REPONSES(S_IdPays, S_IdChapitre,
S_IdSchapitre)
daREPONSES.Fill(S_DataSet.Tables("REPONSES"))
Dim CPTAN As Integer = 3
For I = 1993 To 2008
CPTAN += 1
Tableau = New System.Web.UI.WebControls.Table
Tableau.ID = "Q" + I.ToString
Tableau.CssClass = CssTableau
Tableau.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne1 +
LargeurColonne2 + LargeurColonne3)
Tableau.Visible = False
Ligne = New System.Web.UI.WebControls.TableRow
cell1 = New System.Web.UI.WebControls.TableCell
cell2 = New System.Web.UI.WebControls.TableCell
cell3 = New System.Web.UI.WebControls.TableCell
cell2.CssClass = CssValeur
cell2.Text = "<b>Valeur</b>"
cell3.CssClass = CssSource
cell3.Text = "<b>Source</b>"
Ligne.Cells.Add(cell1)
Ligne.Cells.Add(cell2)
Ligne.Cells.Add(cell3)
Tableau.Rows.Add(Ligne)
For Each Row In S_DataSet.Tables("QUESTIONS").Rows
If Paragraphe <> Row("paragraphe") Then
Ligne = New System.Web.UI.WebControls.TableRow
cell1 = New System.Web.UI.WebControls.TableCell
cell1.ColumnSpan = 3
cell1.CssClass = CssParagraphe
cell1.Text = "<b>" & Row("Paragraphe") & "</b>"
Paragraphe = Row("paragraphe")
Ligne.Cells.Add(cell1)
Tableau.Rows.Add(Ligne)
End If
Ligne = New System.Web.UI.WebControls.TableRow
cell1 = New System.Web.UI.WebControls.TableCell
cell2 = New System.Web.UI.WebControls.TableCell
cell3 = New System.Web.UI.WebControls.TableCell
cell1.CssClass = CssBox
cell2.CssClass = CssBox
cell3.CssClass = CssBox
If Row("Question") = "[TEXT]" Then
Saisie = New System.Web.UI.WebControls.TextBox
Saisie.Attributes.Add("onChange", "changement=1;")
Saisie.Width = System.Web.UI.WebControls.Unit.Point(LargeurBoxSpecial)
Saisie.CssClass = CssBoxSpecial
Saisie.ID = "T_" & Row("idquestion").ToString & "_" & I.ToString
Row1 = S_DataSet.Tables("REPONSES_SPE").Rows.Find(Row("idquestion"))
If Not Row1 Is Nothing Then
Saisie.Text = Row1(CPTAN - 3)
End If
cell1.Controls.Add(Saisie)
Else
cell1.Text = Row("QUESTION")
End If
Saisie = New System.Web.UI.WebControls.TextBox
Saisie.Width = System.Web.UI.WebControls.Unit.Point(LargeurBoxValeur)
Saisie.CssClass = CssBoxValeur
Saisie.ID = Row("idquestion").ToString & "_" & I.ToString
If Val(Row(CPTAN)) > -1 Then
Saisie.Text = Row(CPTAN)
End If
Saisie.Attributes.Add("onChange", "changement=1;")
Saisie.Attributes("onblur") = "TypeChamps(this,'" & Trim(Row("TypeTest"))
& "');"
cell2.Controls.Add(Saisie)
Saisie = New System.Web.UI.WebControls.TextBox
Saisie.Attributes.Add("onChange", "changement=1;")
Saisie.CssClass = CssBoxSource
Saisie.Width = System.Web.UI.WebControls.Unit.Point(LargeurBoxSource)
Saisie.ID = "S" & Row("idquestion").ToString & "_" & I.ToString
Saisie.Text = Row(17 + CPTAN)
cell3.Controls.Add(Saisie)
cell1.CssClass = "texte"
cell2.CssClass = "texte"
cell3.CssClass = "texte"
cell1.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne1)
cell2.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne2)
cell3.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne3)
Ligne.Cells.Add(cell1)
Ligne.Cells.Add(cell2)
Ligne.Cells.Add(cell3)
Tableau.Rows.Add(Ligne)
Next
S_TABLES.Add(I, Tableau)
Next
Dim Table1 As System.Web.UI.WebControls.Table
Table1 = CType(S_TABLES(S_IdAnnee), System.Web.UI.WebControls.Table)
Table1.Visible = True
End Sub
 
S

Stan Sainte-Rose

Ok, I think I ve found my solution
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Table1.RenderControl(hw)
Charge = tw.ToString()


Stan



Stan Sainte-Rose said:
Oopps sorry for the previous post.
As I said, I m trying to make a web custom control and I do know how I have
to convert
this part to for the render section

In fact it may be a stupid question, how to "ouput" this section
Table1 = CType(S_TABLES(S_IdAnnee), System.Web.UI.WebControls.Table)
Table1.Visible = True

Stan

Here's the code

Private Sub ThingToDisplay
Dim I As Integer
Dim Paragraphe As String
Dim Row, Row1 As DataRow
Dim Tableau As New System.Web.UI.WebControls.Table
Dim Ligne As New System.Web.UI.WebControls.TableRow
Dim cell1 As New System.Web.UI.WebControls.TableCell
Dim cell2 As New System.Web.UI.WebControls.TableCell
Dim cell3 As New System.Web.UI.WebControls.TableCell
S_DataSet.Tables.Add("QUESTIONS")
daQUESTIONS.SelectCommand = SQL_LISTE_QUESTIONS(S_Langue, S_IdPays,
S_IdChapitre, S_IdSchapitre)
daQUESTIONS.Fill(S_DataSet.Tables("QUESTIONS"))
With S_DataSet.Tables.Add("REPONSES_SPE")
.Columns.Add("idquestion", GetType(Integer))
For I = 1993 To 2008
.Columns.Add("V" & I.ToString, GetType(String))
Next
.PrimaryKey = New DataColumn() {.Columns("idquestion")}
End With

daREPONSES_SPE.SelectCommand = SQL_LISTE_REPONSES_SPE(S_IdPays,
S_IdChapitre, S_IdSchapitre)
daREPONSES_SPE.Fill(S_DataSet.Tables("REPONSES_SPE"))
With S_DataSet.Tables.Add("REPONSES")
.Columns.Add("idquestion", GetType(Integer))
For I = 1993 To 2008
.Columns.Add("A" & I.ToString, GetType(Decimal))
.Columns.Add("S" & I.ToString, GetType(String))
Next
.PrimaryKey = New DataColumn() {.Columns("idquestion")}
End With
daREPONSES.SelectCommand = SQL_LISTE_REPONSES(S_IdPays, S_IdChapitre,
S_IdSchapitre)
daREPONSES.Fill(S_DataSet.Tables("REPONSES"))
Dim CPTAN As Integer = 3
For I = 1993 To 2008
CPTAN += 1
Tableau = New System.Web.UI.WebControls.Table
Tableau.ID = "Q" + I.ToString
Tableau.CssClass = CssTableau
Tableau.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne1 +
LargeurColonne2 + LargeurColonne3)
Tableau.Visible = False
Ligne = New System.Web.UI.WebControls.TableRow
cell1 = New System.Web.UI.WebControls.TableCell
cell2 = New System.Web.UI.WebControls.TableCell
cell3 = New System.Web.UI.WebControls.TableCell
cell2.CssClass = CssValeur
cell2.Text = "<b>Valeur</b>"
cell3.CssClass = CssSource
cell3.Text = "<b>Source</b>"
Ligne.Cells.Add(cell1)
Ligne.Cells.Add(cell2)
Ligne.Cells.Add(cell3)
Tableau.Rows.Add(Ligne)
For Each Row In S_DataSet.Tables("QUESTIONS").Rows
If Paragraphe <> Row("paragraphe") Then
Ligne = New System.Web.UI.WebControls.TableRow
cell1 = New System.Web.UI.WebControls.TableCell
cell1.ColumnSpan = 3
cell1.CssClass = CssParagraphe
cell1.Text = "<b>" & Row("Paragraphe") & "</b>"
Paragraphe = Row("paragraphe")
Ligne.Cells.Add(cell1)
Tableau.Rows.Add(Ligne)
End If
Ligne = New System.Web.UI.WebControls.TableRow
cell1 = New System.Web.UI.WebControls.TableCell
cell2 = New System.Web.UI.WebControls.TableCell
cell3 = New System.Web.UI.WebControls.TableCell
cell1.CssClass = CssBox
cell2.CssClass = CssBox
cell3.CssClass = CssBox
If Row("Question") = "[TEXT]" Then
Saisie = New System.Web.UI.WebControls.TextBox
Saisie.Attributes.Add("onChange", "changement=1;")
Saisie.Width = System.Web.UI.WebControls.Unit.Point(LargeurBoxSpecial)
Saisie.CssClass = CssBoxSpecial
Saisie.ID = "T_" & Row("idquestion").ToString & "_" & I.ToString
Row1 = S_DataSet.Tables("REPONSES_SPE").Rows.Find(Row("idquestion"))
If Not Row1 Is Nothing Then
Saisie.Text = Row1(CPTAN - 3)
End If
cell1.Controls.Add(Saisie)
Else
cell1.Text = Row("QUESTION")
End If
Saisie = New System.Web.UI.WebControls.TextBox
Saisie.Width = System.Web.UI.WebControls.Unit.Point(LargeurBoxValeur)
Saisie.CssClass = CssBoxValeur
Saisie.ID = Row("idquestion").ToString & "_" & I.ToString
If Val(Row(CPTAN)) > -1 Then
Saisie.Text = Row(CPTAN)
End If
Saisie.Attributes.Add("onChange", "changement=1;")
Saisie.Attributes("onblur") = "TypeChamps(this,'" & Trim(Row("TypeTest"))
& "');"
cell2.Controls.Add(Saisie)
Saisie = New System.Web.UI.WebControls.TextBox
Saisie.Attributes.Add("onChange", "changement=1;")
Saisie.CssClass = CssBoxSource
Saisie.Width = System.Web.UI.WebControls.Unit.Point(LargeurBoxSource)
Saisie.ID = "S" & Row("idquestion").ToString & "_" & I.ToString
Saisie.Text = Row(17 + CPTAN)
cell3.Controls.Add(Saisie)
cell1.CssClass = "texte"
cell2.CssClass = "texte"
cell3.CssClass = "texte"
cell1.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne1)
cell2.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne2)
cell3.Width = System.Web.UI.WebControls.Unit.Point(LargeurColonne3)
Ligne.Cells.Add(cell1)
Ligne.Cells.Add(cell2)
Ligne.Cells.Add(cell3)
Tableau.Rows.Add(Ligne)
Next
S_TABLES.Add(I, Tableau)
Next
Dim Table1 As System.Web.UI.WebControls.Table
Table1 = CType(S_TABLES(S_IdAnnee), System.Web.UI.WebControls.Table)
Table1.Visible = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top