Click here to Skip to main content
16,007,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am trying to send value of product id which is inside repeater control from query string but when
i click on button it only passes first value and other values of product id not passed .
Please have a look in code and suggest me solution
ASP.NET
<asp:Repeater ID="productdetailsauto" runat="server">
      <HeaderTemplate></HeaderTemplate>
      <itemtemplate>
     <!-- Products Single Box -->
     <li class="span3">
       <div class="thumbnail">
         <a href="#" class="thumb"><img src='data:image/gif;base64,<%#Eval("img64") %>' alt="Product" /></a>
         <p><a href="#"><%#Eval("Product_Name")%></a></p>
         <p class="price"><span>2</span></i__^^__i class="icon-star"__^<span>3</span>^__i class="icon-star-half-empty"><span>4</span>^__i class="icon-star-empty"><span>5</span></p>
         <input id="btnaddtocart" type="button" value="Add to Cart" class="btn" onclick="Redirect2()"/>
         <input id="hidproduct2" type="text"  value='<%#Eval("Product_Id")%>' />
          <script type="text/javascript">
              function Redirect2() {
                  var t2 = document.getElementById("hidproduct2").value;
                  window.location = 'productdetails.aspx?t2=' + t2;
                  t2 = "";
              }
   </script>
         <a href="#" class="add-list">^__i class="icon-star">Wish List</a><a href="#" class="add-comp">^__i class="icon-tasks">Compare</a><span class="new">New</span></div>
     </li>
     </itemtemplate>
Posted
Updated 23-Jun-14 0:22am
v2
Comments
Karthick Viswanathan 23-Jun-14 6:21am    
Hi,

Please give the code more clear to solve the issue
Kornfeld Eliyahu Peter 23-Jun-14 6:23am    
You better use browsers' debugging ability to see what exact HTML created for this repeater - that may explain to you what going on...

1 solution

Please use below code
Window.open('productdetails.aspx?t2=' + t2);


instead of
window.location = 'productdetails.aspx?t2=' + t2;
 
Share this answer
 

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