J'ai créé un HTMLTable et je veux l'envoyer par courriel:comment un courriel HtmlTable créé dynamiquement - vb.net
Dim MyRow As New HtmlTableRow
Dim cellCost, cellDisplayName, cellMoreInfo As New HtmlTableCell
Dim tableAttributes As New HtmlTable
tableAttributes.ID = "test"
cellCost.InnerText = "$45.00"
cellDisplayName.InnerText = "I am display Name"
cellMoreInfo.InnerText = "I am more information"
MyRow.Cells.Add(cellCost)
MyRow.Cells.Add(cellDisplayName)
MyRow.Cells.Add(cellMoreInfo)
tableAttributes.Rows.Add(MyRow)
PlaceHolder1.Controls.Add(tableAttributes)
Lorsque vous essayez d'envoyer un courriel la variable globale tableAttributes
... et c'est là je tombe problèmes:
Message.Body = tableAttributes.anything
< - échoue.
Comment puis-je créer une table générée dynamiquement, puis l'envoyer par courrier électronique? UPDATE - une solution a été fournie
Ha ha! ça a marché, tu es génial. C'est ce que j'ai créé à partir de votre conseil:
Dim SB As New StringBuilder()
Dim SW As New StringWriter(SB)
Dim htmlTW As New HtmlTextWriter(SW)
Dim x As New HtmlTable
x = Session("table")
x.RenderControl(htmlTW)
Dim sTable As String = SB.ToString()
Response.Write("*" & sTable & "*")
Génial. Je googling et en donnant un coup de feu! – user995727
Désolé, je ne sais pas comment faire ça ... mais je pense que votre idée va fonctionner. – user995727
Ha ha! ça a marché, tu es génial. – user995727