Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
TBarButton toolbar button image being lost on postback when using programatically created buttons
posted

The scenario is this. I have a customisable form to which custom buttons can be added to the toolbar using an admin tool. I use this code in the Page_Load to create each button (it's run in a loop) when the page is first loaded. Viewstate is enabled on the toolbar.

                            Dim newButton As New UltraWebToolbar.TBarButton
                            newButton.Text = cfb.Label
                            newButton.Key = cfb.ControlID

                            Select Case cfb.Type
                                Case CustomFormButtonConfig.ButtonType.CallStoredProc
                                    newButton.Images.DefaultImage.Url = "../Icons/16x16/data_gear.gif"
                                    newButton.Images.DisabledImage.Url = "../Icons/16x16/data_gear.gif"
                                Case CustomFormButtonConfig.ButtonType.OpenURL
                                    newButton.Images.DefaultImage.Url = "../Icons/16x16/earth_view.gif"
                                    newButton.Images.DisabledImage.Url = "../Icons/16x16/earth_view.gif"
                            End Select

                            newButton.ToolTip = cfb.ToolTip
                            newButton.Enabled = cfb.IsEnabled(_currentEntry)
                            tbMain.Items.Insert(8 + posCount, newButton)

 

When the page does a postback the button remains but the image is completely lost and does not display next to the text. This did work in 2006v2 (we are in the process of upgrading to .Net 3.5 and 2008v1). 

Does anyone have a workaround or will this be a hotfix job?

Cheers,

Paul