I want to get my listview to scroll to the user selected index and change its appearance. I tired to get this in many ways but nothing worked for me.
When I select any item from listview I am able to get the data and index of selected item but the SelectedTemplate apply on previous Index. Don't know how ?
for eg: By Default I selected index "0", so when I select index "3" the SelectedTemplate applies on index "0" and when I select index "5" the SelectedTemplate applies on index "3".
Codes are below, hope to get some help.
WebForm

Code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
       <ContentTemplate>
            <div class="VDOContainer raw">
                <div class="vdoname" id="area" runat="server">
                    <asp:Label ID="VDOName" runat="server"CssClass="vdofonthead"Text="Video Name"></asp:Label>
                </div>

                <div class="boxleft col-lg-8 col-md-8 col-sm-12">
                    <asp:Literal ID="lblvedio" runat="server"></asp:Literal>
                    <ul class="raw like-section">
                        <li class="col-md-6 like-btn">
                            <asp:Button ID="btn_Like" runat="server"Text="Like"CssClass="btn btn-outline btn-lg"></asp:Button>
                            <div class="btn btn-lg" style="cursor:default;">
                                <img class="vlike" src="img/like.png" alt="like image"/>
                                <asp:Label ID="lblLike" runat="server"></asp:Label>
                            </div>
                            <div class="btn btn-lg" style="cursor:default;">
                                <img class="vlike" src="img/like.png" alt="like image"/>
                                <asp:Label ID="lblView" runat="server"></asp:Label>
                                Views
                            </div>
                        </li>
                    </ul>
                    <div class="vdoname" id="Div1" runat="server">
                        <asp:Label ID="VDODesc" runat="server"CssClass="vdofonthead"Text="Video Description"></asp:Label>
                    </div>
                </div>

                <div class="boxright col-lg-4 col-md-4 col-sm-12">
                    <asp:ListView runat="server" ID="listviedo"
                        OnSelectedIndexChanged="listviedo_SelectedIndexChanged"
                        OnSelectedIndexChanging="listviedo_SelectedIndexChanging"
                        SelectedIndex="0"FullRowSelect="true" 
                        DataKeyNames="VID"ClientIDMode="AutoID">
                        <ItemTemplate>
                            <asp:Panel runat="server" ID="selected_panel">
                                <div class="vdofont">
                                    <asp:LinkButton runat="server" ID="linkbtn"CommandName="Select"CommandArgument='<%# Eval("VID") %>'>
                                        <asp:Label ID="lblname" runat="server"Text='<%# Eval("VideoName")%>'></asp:Label>
                                        <asp:Label ID="lblid" runat="server"Visible="false"Text='<%# Eval("VID")%>'></asp:Label>
                                    </asp:LinkButton>
                                </div>
                            </asp:Panel>
                        </ItemTemplate>
                        <SelectedItemTemplate>
                            <asp:Panel runat="server" ID="selected_panel"CssClass="boxright_active"BackColor="SkyBlue"> 
                                <div class="vdofont boxright_active">
                                    <asp:LinkButton runat="server" ID="linkbtn"CommandName="Select"CommandArgument='<%# Eval("VID") %>'>
                                        <asp:Label ID="lblname" runat="server"Text='<%# Eval("VideoName")%>'></asp:Label>
                                        <asp:Label ID="lblid" runat="server"Visible="false"Text='<%# Eval("VID")%>'></asp:Label>
                                    </asp:LinkButton>
                                </div>
                            </asp:Panel>
                        </SelectedItemTemplate>
                    </asp:ListView>
                </div>
            </div>

        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTriggerControlID="listviedo"EventName="SelectedIndexChanged"/>
            <asp:AsyncPostBackTriggerControlID="listviedo"EventName="SelectedIndexChanging"/>
            <asp:AsyncPostBackTriggerControlID="listviedo"EventName="ItemCommand"/>
        </Triggers>
</asp:UpdatePanel>



C# Code Behind

Code:
 
Code:
protectedvoid listviedo_ItemCommand(object sender,ListViewCommandEventArgs e)
    {
        Literal lblvedio =(Literal)e.Item.FindControl("lblvedio");
        Label lblname =(Label)e.Item.FindControl("lblname");
        if(e.CommandName=="Select")
        {
            int ID =Convert.ToInt32(e.CommandArgument);
            Database.Tbl obj = DB.Tbl.Single(p => p.VID == ID);
            if(obj.IsUrl==false)
            {
                stringLink="<iframe></iframe>";
            }
            else
            {
                stringLink="<iframe></iframe>";
            }
        }
        if(e.CommandName=="Resume")
        {
            int ID =Convert.ToInt32(e.CommandArgument);
            Database.Tbl objcar = DB.Tbl.Single(p => p.VID == ID); 
        }
    }
    protectedvoid listviedo_ItemDataBound(object sender,ListViewItemEventArgs e)
    {
        Label lblid =(Label)e.Item.FindControl("lblid");
        LinkButton linkresuume =(LinkButton)e.Item.FindControl("linkresuume");
        int ID =Convert.ToInt32(lblid.Text);
        Database.Tbl objcar = DB.Tbl.Single(p => p.VID == ID);            
    }
    protectedvoid listviedo_SelectedIndexChanged(object sender,EventArgs e)
    {
        if(Session["USER"]==null)
        {
            Response.Redirect("Login");
        }
        else
        {
                            if(listviedo.SelectedIndex>=0)
            {
                int id1 =Convert.ToInt32(listviedo.SelectedValue.ToString());
                lblvedio.Text= getvalue(id1);
                VDOName.Text= getName(id1);
                VDODesc.Text= getDesc(id1);
                lblView.Text= getView(id1).ToString();
                lblLike.Text= getLike(id1).ToString();
            }
        }
    }

    protectedvoid listviedo_SelectedIndexChanging(object sender,ListViewSelectEventArgs e)
    { 
        this.listviedo.SelectedIndex= e.NewSelectedIndex; 
    }



CSS
Code:
 
Code:
.boxright {
            float: left;
            height:890px;
            margin:0auto;
            overflow:auto;
            padding:10px10px10px10px;
            background-color: rgba(0,0,255,0.12);
        }

        .boxright div:hover {
            transform: scale(1.01);
            box-shadow:1px1px5px0px#777;
            border-radius:5px;
        }

        .boxright_active {
            transform: scale(1.01);
            box-shadow:1px1px10px0px#777;
            border-radius:5px;
        }

        .boxright div:active {
            transform: scale(1.01);
            box-shadow:1px1px10px0px#777;
            border-radius:5px;
        }

        .boxleft {
            float: left;
            margin:0auto;
            padding:15px;
            overflow: hidden;
        }