|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi I'm trying to create a Flyout control dynamically (server side), and I'm getting an error "An exception of type 'System.NullReferenceException' occurred in EO.Web.DLL but was not handled in user code Object reference not set to an instance of an object ". My code is below:
Code: Visual Basic.NET
Private Sub MontaFlyAtualizacao(ByVal Ctr As Integer)
Dim Fly As EO.Web.Flyout = Nothing, rowFly As System.Web.UI.HtmlControls.HtmlTableRow = Nothing, _
cellFly As System.Web.UI.HtmlControls.HtmlTableCell = Nothing, tableFly As System.Web.UI.HtmlControls.HtmlTable = Nothing, _
LarguraFly As Integer = 300, AlturaFly As Integer = 50, botao As System.Web.UI.WebControls.Button = Nothing
Fly = New EO.Web.Flyout
Fly.ID = "SistemaAtu" & Format(Ctr, "00")
Fly.ExpandDirection = EO.Web.ExpandDirection.BottomLeft
Fly.For = "cmdSistema" & Format(Ctr, "00")
Fly.Width = System.Web.UI.WebControls.Unit.Pixel(LarguraFly)
Fly.Height = System.Web.UI.WebControls.Unit.Pixel(AlturaFly)
tableFly = New System.Web.UI.HtmlControls.HtmlTable
tableFly.ID = "tabAtualizaSistema" & Format(Ctr, "00")
tableFly.Width = "100%"
tableFly.Height = "100%"
rowFly = New System.Web.UI.HtmlControls.HtmlTableRow
cellFly = New System.Web.UI.HtmlControls.HtmlTableCell
cellFly.Width = "100%"
cellFly.Style.Add("padding-right", "15px")
cellFly.Style.Add("padding-left", "15px")
cellFly.Style.Add("padding-top", "15px")
cellFly.Style.Add("padding-bottom", "15px")
botao = New System.Web.UI.WebControls.Button
botao.ID = "cmdAtualizaSistema" & Format(Ctr, "00")
botao.Font.Size = 9
botao.ForeColor = Color.Red
botao.Font.Name = "Verdana"
botao.Font.Bold = True
botao.Text = ENVLang.LiteralLocalization(2677, TabSystems(Ctr).ObjectSystemPrefix)
botao.PostBackUrl = "systemupdate.aspx?system=" & TabSystems(Ctr).ObjectSystemPrefix
cellFly.Controls.Add(botao)
rowFly.Controls.Add(cellFly)
tableFly.Controls.Add(rowFly)
Fly.Controls.Add(tableFly)
Me.form1.Controls.Add(Fly)
End Sub
TabSystems is an array structure that has the systems informations available to an user, and all their fields are OK. The error occurs in the command "Me.form1.Controls.Add(Fly)". What am I doing wrong? Is there any example in this site that shows how create a Flyout control dynamically? Thanks in advance, Marcelo Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
Do you have the callstack of the error? Also please provide the version number of the DLL. This way we can decode the obfuscated callstack and match it with our source code.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi support, Thanks for your quick reply. The page with callstack of the error is below: Sorry, but there are some words in Portuguese because I live in Brazil. So, I put the error page in the HTM format in this link. The version of the EOWeb.DLL is 17.0.95.0 and I use it in Visual Studio 2005 with the .NET Framework 2.0. Regards, Marcelo Camarate
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
The error is caused by the Flyout control's ContentTemplate property being null. You will need to create a class that implements ITemplate, then create an instance of that class and assign it to the Flyout's ContentTemplate property. That class's ITemplate.InstantiateIn function is responsible for creating the contents of the Flyout control.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/2/2010 Posts: 120
|
Hi,
Thanks for your reply.
I put the HTML table creation inside an ITemplate class and now it's working.
Regards,
Marcelo Camarate
|
|