SlideShow in UpdatePanel

Feb 8, 2008 at 6:01 PM
Trying to add the SlideShow script to the scriptmanager in a UpdatePanel, the updatePanel contains a multiview control and I'm trying to get the SlideShow control into one of the views. Is this possible with the current version? This is a snippet of the code.

Private Sub SlideShowLinkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SlideShowLinkButton.Click
Dim sm As ScriptManager = ScriptManager.GetCurrent(Me.Page)
Dim script1 As New ScriptReference("javascript/Silverlight.js")
Dim script2 As New ScriptReference("javascript/SlideShow.js")
Dim ssScript As String = "new SlideShow.Control(new SlideShow.XmlConfigProvider({url:'javascript/Configuration.xml'}));"

sm.Scripts.Add(script1)
sm.Scripts.Add(script2)

ScriptManager.RegisterStartupScript(Me.Page, Me.GetType, "SlideShowScript", ssScript, True)

Me.ContentMultiView.ActiveViewIndex = Views.SlideShow
Me.SideBarViewsMultiView.ActiveViewIndex = Views.SlideShow

UpdatePanels()
End Sub

Thanks in advance for any tips.....
Burl
Developer
Feb 9, 2008 at 2:18 AM
I haven't tried anything like this, but I don't think RegisterStartUpScript is what you want to use. Wouldn't this place it in the <head> element?

The Slide.Show script needs to be where you actually want the control to appear. Just put it as the content of the View.
Feb 9, 2008 at 3:55 AM


mathisjay wrote:
I haven't tried anything like this, but I don't think RegisterStartUpScript is what you want to use. Wouldn't this place it in the <head> element?

The Slide.Show script needs to be where you actually want the control to appear. Just put it as the content of the View.


Thanks for the reply,

I created a sample page of my real project layout and was able to get it to work as expected, I was able to add a postbackTrigger for a linkbutton from another update panel on the page. However, when I created another page that inherits from a masterpage with the same layout as the other sample page, it wasn't able to find the linkbutton even though it shows the linkbutton.UniqueId during debug...... UGH

I'll load up the sample code tomorrow if I can't figure this out tonight...........driving me nuts! and it a short drive :) This is a really great control by the way........

Regards, Burl
Feb 9, 2008 at 9:23 PM
Solved the problem...

Added this to the OnInit event for the page derived from the MasterPage.

Dim sm As ScriptManager = CType(Master.FindControl("ScriptManager1"), ScriptManager)
sm.RegisterPostBackControl(Me.SlideShowLinkButton)

and I have the script in the Multiview.View(index)

<script type="text/javascript">
new SlideShow.Control(new SlideShow.XmlConfigProvider({url:"javascript/Configuration.xml"}));
</script>

Works great.......


Mar 17, 2008 at 6:41 AM
Edited Mar 17, 2008 at 3:54 PM
Hi all,

I'm having a similar problem.

My scriptmanager is on my masterpage, there is a menu on the masterpage within an updatepanel.
The content page has a formview within an updatepanel (updatepanel1) that displays product category info from a db when a menu item on the masterpage is clicked:

Protected Sub MenuProd_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs)
If e.Item.NavigateUrl = "" Then
Dim upl As UpdatePanel
upl = ContentPlaceHolder1.FindControl("UpdatePanel1")
upl.Update()
Dim hfprodtypeid As HiddenField = ContentPlaceHolder1.FindControl("hfprodtypeid")
hfprodtypeid.Value = e.Item.Value
End If
End Sub

The objectdatasource for the formview gets its input parameter from the hiddenfield "hfprodtypeid" on the contentpage and asynchronously changes the data on the content page from the masterpage.
This all works perfectly.

I added the SlideShow.Control script to the position in the formview where I once had just one image from the database (the idea is to show several images with this awesome Slide.show control and not just one)
<script id="SlideShowScript" type="text/javascript">
new SlideShow.Control(new SlideShow.XmlConfigProvider());
</script>

The script references are in the scriptmanager on the masterpage:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="SlideShow/slideshow.js" />
<asp:ScriptReference Path="SlideShow/Silverlight.js" />
</Scripts>
</asp:ScriptManager>

On the first click of the Product type menu on the master page, the images in the slideshow appear and transition correctly but all subsequent clicks on other product types cause the slideshow control to dissappear until I do a hard postback. (the other functionality in the formview updates from the db correctly but the slideshow control is missing)

Sorry for all the detail but it seemed important to include.

@Burldo - I'm not sure I understand how you made your solution work, can you provide more detail? Tks

What do I have to do to have the slideshow control refresh with the other data in the updatepanel?

Thanks,

Luke