title: ASP.NET ListView: Calling a Javascript function from an OnItemClick event?
body: <p>I need to get the click event of a ListView item to refresh another ListView without refresing the entire page. Basically use javascript to refresh ListView No.2 when a user clicks on any item of ListView no.1. Here's what I tried:</p>
  
  <p>ListView 1:</p>
  
  <pre><code>&lt;asp:ListView ID="LeftsideMessageList" runat="server" ItemPlaceholderID="itemPlaceHolder1"  DataKeyNames="id" OnSelectedIndexChanged="LeftsideMessageList_SelectedIndexChanged"  &gt;
  </code></pre>
  
  <p>ListView 2 (which refreshes everytime any item of LV1 is clicked/selected)</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="videosUpdatePanel" runat="server" OnLoad="videosUpdatePanel_Load" &gt; 
          &lt;ContentTemplate&gt;
               &lt;asp:ListView ID="videosListView"  runat="server" ItemPlaceholderID="itemPlaceHolder1"&gt;
              //List view items and stuff
           &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>And my javascript:</p>
  
  <pre><code>&lt;script
          type="text/javascript"&gt; function GetVideos() { __doPostBack("&lt;%=videosUpdatePanel.UniqueID %&gt;", ""); } 
      &lt;/script&gt;
  </code></pre>
  
  <p>I just have to simply call the GetVideos() javascript method to fire the videosUpdatePanel's C# OnLoad method:</p>
  
  <pre><code>protected void videosUpdatePanel_Load(object sender, EventArgs e)
  {
          string email = Session["Username"].ToString();
          List&lt;Activity&gt; videos = BC.getMediaOfUser(email, "Video");
  
          videosListView.DataSource = videos;
          videosListView.DataBind();
  }
  </code></pre>
  
  <p>Here's the procedure I have in mind:</p>
  
  <blockquote>
    <p><strong>Click/Select any item from LV1 -> Call the GetVideos() Javascript -> Call Update panel's OnLoad to refresh LV2</strong></p>
  </blockquote>
  
  <p>Where I'm stuck at is, how do I call the GetVideos() function since ASP ListViews do not have a OnClick method? What is the method to call the ListView No.1's OnItemClick?</p>