如何使这个JavaScript与listview中的所有页面一起使用 [英] how to make this javascript work with all pages in listview
问题描述
欢迎所有人:
我想问你这个javascript,这是一个代码和平:
< ItemTemplate >
< td id = Td2 runat = 服务器 style = border:solid; width:inherit; border-color:white; font-size:medium; > ;
名称:
< asp:标签 ID = nameLabel runat = server 文字 =' <% #Eval( name)%> ' / >
< br / >
类别:
< asp:标签 ID = categoryLabel runat = server 文本 =' < % #Eval( category) %> ' / >
< br / >
available_quantity:
< asp:标签 ID = available_quantityLabel runat < span class =code-keyword> = server 文本 =' <% #Eval( available_quantity)%> ; ' / >
< br / >
< asp:图像 ID = product_image runat = 服务器 ImageUrl =' <% #Eval( 照片)%> ' style = cursor:指针 class = magnify width < span class =code-keyword> = 150 高度 = 150 align = 底部 / >
< br / >
Detailes:
< a href =' <%# ProductDetailes.aspx?product_id = + Eval( product_id)%> ' < span class =code-attribute> rel = ajaxpanel > 查看产品详细信息.. < / a >
< br < span class =code-attribute> / >
< / td >
< / ItemTemplate >
这是这个ListView的DataPager:
< asp:DataPager ID = Da taPager1 runat = server PageSize = 15 >
< 字段 >
< asp:NextPreviousPagerField ButtonType = 链接 ShowFirstPageButton = True ShowNextPageButton = False ShowPreviousPageButton = False / >
< asp:NumericPagerField / < span class =code-keyword>>
< asp:NextPreviousPagerField ButtonType = 链接 ShowLastPageButton = 真 < span class =code-attribute> ShowNextPageButton = False ShowPreviousPageButton = 错误 / >
< / Fields >
< / asp:DataPager > 跨度>
我在页面中安装了一个脚本:
< script type =' text / javascript' src =' https://ajax.googleapis.com/ajax/libs/jquery /1.7.2/jquery.min.js'> < / script >
< < span class =code-leadattribute> link rel = 样式表 type = text / css href = scripts / ddajaxsidepanel .css / >
< script src = scripts / ddajaxsidepanel.js >
它在漂亮的面板中打开一个新的网页,但它需要添加属性rel =ajaxpanel表示您要在此面板中打开它的任何链接。我在listview中添加了这个属性,你可以从上面的代码中看到。
脚本只能在listview的第一页工作正常,但是当你点击2时(第二页)在DataPager中它不起作用,而是在同一页面打开链接。
你可以从这里获得脚本:
http://www.dynamicdrive.com/dynamicindex17/ajaxsidepanel.htm [ ^ ]
请任何帮助使脚本适用于listview中的所有页面将不胜感激:)
祝你好运。
请参阅我最近的回答:将ListView元素导入JavaScript数组 [ ^ ]。
-SA
Welcome all:
I would like to ask you about this javascript, this is a peace of code:
<ItemTemplate>
<td id="Td2" runat="server" style="border:solid; width:inherit; border-color:white; font-size:medium;">
name:
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
<br />
category:
<asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
<br />
available_quantity:
<asp:Label ID="available_quantityLabel" runat="server" Text='<%# Eval("available_quantity") %>' />
<br />
<asp:Image ID="product_image" runat="server" ImageUrl='<%# Eval("photo") %>' style="cursor:pointer" class="magnify" width="150" height="150" align="Bottom" />
<br />
Detailes:
<a href='<%# "ProductDetailes.aspx?product_id="+ Eval("product_id") %>' rel="ajaxpanel" > See product details..</a>
<br />
</td>
</ItemTemplate>
and this is a DataPager for this ListView:
<asp:DataPager ID="DataPager1" runat="server" PageSize="15" >
<Fields>
<asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
I installed a script in the page:
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css" href="scripts/ddajaxsidepanel.css" />
<script src="scripts/ddajaxsidepanel.js">
it opens a new web page in nice panel, but it requires to add the property rel="ajaxpanel" for any link you would like to open it in this panel. I added this property in the listview as you can see from the code above.
the script works fine ONLY in the first page of listview, but when you hit 2 (page two) in the DataPager it doen''t work, rather, it opens the link in the same page.
you can get the script from here:
http://www.dynamicdrive.com/dynamicindex17/ajaxsidepanel.htm[^]
please any help to make the script works for all pages in the listview would be appreciated :)
Best regards.
Please see my recent answer: Get ListView elements into JavaScript Array[^].
—SA
这篇关于如何使这个JavaScript与listview中的所有页面一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!