This is a migrated thread and some comments may be shown as answers.

Paging and javascript problem

6 Answers 86 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Vasja Petkovska
Top achievements
Rank 1
Vasja Petkovska asked on 15 May 2010, 11:31 PM
I am using ListView with paging to display photos, and jquery lightbox js to display the photos when clicked.
On the first page the photos display using the lightbox, but when i click next the photos wont display right, like the js is not loaded.
The ListView is inside asp:Panel control, and the panel is handled by AjaxManager.
Any ideas?

6 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 17 May 2010, 11:29 AM
Hello Vasja,

For your convenience I am attaching sample application demonstrating usage of Lightbox plugin with RadListView.

Greetings,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Vasja Petkovska
Top achievements
Rank 1
answered on 17 May 2010, 10:50 PM
Hello, i reviewed the code but i dont see what am i missing? This is part of my code

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> 
<link href="css/slimbox2.css" rel="stylesheet" type="text/css" /> 
<script type="text/javascript" src="js/slimbox2.js"></script> 
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="ListViewPanel1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="ListViewPanel1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
</telerik:RadAjaxManager> 
 
<asp:Panel ID="ListViewPanel1" runat="server"
                            <telerik:RadListView ID="listImages" runat="server" ItemPlaceholderID="ImagesContainer" 
                                OnItemCommand="listImages_ItemCommand" AllowPaging="true" PageSize="16" DataKeyNames="ImageID" 
                                OnPageIndexChanged="listImages_PageIndexChanged"
                                <ItemTemplate>...</ItemTemplate> 
                                <LayoutTemplate> 
                                    <fieldset id="FieldSet1"
                                        <asp:PlaceHolder ID="ImagesContainer" runat="server" /> 
                                        <center> 
                                            <table cellpadding="5" cellspacing="5" width="600px"
                                                <tr> 
                                                    <td> 
                                                        <asp:Button runat="server" ID="btnFirst" CommandName="Page" CommandArgument="First" 
                                                            Text="Прва" Enabled="<%#Container.CurrentPageIndex > 0 %>" /> 
                                                    </td> 
                                                    <td> 
                                                        <asp:Button runat="server" ID="btnPrev" CommandName="Page" CommandArgument="Prev" 
                                                            Text="Претходна" Enabled="<%#Container.CurrentPageIndex > 0 %>" /> 
                                                    </td> 
                                                    <td> 
                                                        <span style="vertical-align: top; position: relative; top: 4px">Страна 
                                                            <%#Container.CurrentPageIndex + 1 %> 
                                                            од 
                                                            <%#Container.PageCount %></span
                                                    </td> 
                                                    <td> 
                                                        <asp:Button runat="server" ID="btnNext" CommandName="Page" CommandArgument="Next" 
                                                            Text="Следна" Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" /> 
                                                    </td> 
                                                    <td> 
                                                        <asp:Button runat="server" ID="btnLast" CommandName="Page" CommandArgument="Last" 
                                                            Text="Последна" Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" /> 
                                                    </td> 
                                                </tr> 
                                            </table> 
                                        </center> 
                                    </fieldset> 
                                </LayoutTemplate> 
 </telerik:RadListView> 
</asp:Panel> 

0
Nikolay Rusev
Telerik team
answered on 18 May 2010, 08:23 AM
Hello Vasja,

Please notice how the plugin is initialized in my code:
1.<script type="text/javascript">         
2. function pageLoad()
3. {
4.   $('#ourManualGallery a').lightbox();
5. }          
6.</script>

Greetings,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Vasja Petkovska
Top achievements
Rank 1
answered on 06 Jun 2010, 06:00 PM
I am working on this problem for two weeks and i cant solve it!
I have even consulted with the people who developed the lightbox i am using.
I have tried your solution 

 <script type="text/javascript" language="javascript">         
        function loadYOX()
        {
            $("a.yoxview").yoxview();
            $("a.yoxview img").yoxview(); 
        }
</script>

 protected void listImages_PageIndexChanged(object sender, RadListViewPageChangedEventArgs e)
        {
            BindImages(Convert.ToInt32(C));
            Page.ClientScript.RegisterStartupScript(this.GetType(), "yoxview", "loadYOX();", true);
        }

and many other solutions but nothing seems to work. I have spent more time solving this problem than developing the web.
0
Accepted
Nikolay Rusev
Telerik team
answered on 07 Jun 2010, 11:56 AM
Hello Vasja,

I assume you are looking for ScriptManager.RegisterStartupScript method instead of Page.ClientScript.RegisterStartupScript.

Regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Vasja Petkovska
Top achievements
Rank 1
answered on 08 Jun 2010, 12:30 AM
Yep it worked.

protected void listImages_PageIndexChanged(object sender, RadListViewPageChangedEventArgs e)
{ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "yoxview", "loadYOX()", true);}

<script type="text/javascript" language="javascript">         
        function loadYOX()
        {
            jQuery.yoxviewUnload();
            $(".yoxview").yoxview();
        }
</script>
Tags
ListView
Asked by
Vasja Petkovska
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Vasja Petkovska
Top achievements
Rank 1
Share this question
or