title: How to Call javascript function on button click of Repeater event Repeater1_ItemDataBound
body: <p>I want to open pop window on button click of repeater according to id which is binding to current row.I write this javascript function which I want to call according to row id which is unique.Then this java script function called from ItemDataBound event of repeater.   </p>
  
  <pre><code>   This is java script code :
  
      &lt;script type="text/javascript"&gt;
          function test(lblEduCatId) {
              window.onload = function() {
                  var modal = document.getElementById('myModal');
                  var btn = document.getElementById("&lt;%=btnAccess.ClientID %&gt;").value;
                  var span = document.getElementsByClassName("close")[0];
  
                  btn.onclick = function() {
                      modal.style.display = "block";
                  }
  
                  span.onclick = function() {
                      modal.style.display = "none";
                  }
  
                  window.onclick = function(event) {
                      if (event.target == modal) {
                          modal.style.display = "none";
                      }
                  }
              }
          }
  
  
      &lt;/script&gt;
  
  
  .cs code
  
   protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
          if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
          {
              string lblEduCatId = DataBinder.Eval(e.Item.DataItem, "EduCatId").ToString();
              string lblIsFree = DataBinder.Eval(e.Item.DataItem, "IsFree").ToString();
              string lblAccess = DataBinder.Eval(e.Item.DataItem, "Access").ToString();
  
  
              Button access = (Button)e.Item.FindControl("btnAccess");
              access.OnClientClick = "return test(lblEduCatId);";
  
              if (Session["UserName"] != null)
              {
                  if (lblAccess.ToString() == "True")
                  {
                      access.Text = "Access";
                      access.CommandName = "Access";
                  }
                  else
                  {
                      access.Text = "Subscribe";
                      access.CommandName = "Subscribe";
                  }
              }
              else
              {
                  if (lblIsFree.ToString() == "True")
                  {
                      access.Text = "Access";
                      access.CommandName = "Access";
                  }
                  else
                  {
                      access.Text = "Subscribe";
                      access.CommandName = "Subscribe";
                  }
              }
          }
  
  
      }
  </code></pre>