Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a listview bigger than screen size. My code on aspx page is
HTML
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">

            </asp:ScriptManager>
<div style="removed:relative; width:100%; height:20%; overflow-x:auto;">
//code for single line listview placed here which includes
<asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource1" OnItemCommand="ListView1_ItemCommand">
//Item template is designed to display thumbs 
<ItemTemplate>
                    <td  runat="server" style="">
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("Serial") %>'><img src='<%# "/AssetsBack/Thumbs/"+Eval("Serial")+".jpg" %>'" /></asp:LinkButton>
                        
                        <br />
                    </td>
                </ItemTemplate>
</div>
<div style="removed:relative; width:100%; height:80%;">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
            <img id="imag"  runat="server" style="width:100%; height:100%;" />
            </ContentTemplate>
            </asp:UpdatePanel>
            </div>

My code behind for OnItemCommand is
C#
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string im = e.CommandArgument.ToString();
        imag.Attributes.Add("src", "/AssetsBack/" + im + ".jpg");
        ListView1.DataBind();
    }
// this is designed to display images corresponding to the thumb that is clicked in listview


When I click on thumb in listview, corresponding image is displayed in the second div but on click instead of refreshing only the image, the entire listview gets refreshed and listview displays from first item and user has to scroll back to the thumb where he clicked.
Is there any way I can refresh the image selected but the listview stays at the position where the user clicked it.
Posted
Updated 27-Nov-14 23:16pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900