当前位置: 代码迷 >> ASP.NET >> 使用JS向Repeater中的TEXT控件斌值,该怎么解决
  详细解决方案

使用JS向Repeater中的TEXT控件斌值,该怎么解决

热度:3305   发布时间:2013-02-25 00:00:00.0
使用JS向Repeater中的TEXT控件斌值
C# code
function addshow(obj){var count= parseInt("<%=this.Repeater1.Items.Count%>")for (var i=0;i<count;i++){document.getElementById('PayPrice'+i).value=obj;}}                        <asp:Repeater ID="Repeater1" runat="server">                          <ItemTemplate>                            <tr>                            <td align="left" background="../IMG/Order_bg_2.gif" ><asp:TextBox ID="PayPrice" runat="server" Width="9px" Text='<%#Convert.ToDouble(Eval("Price").ToString()).ToString("N0")%>'></asp:TextBox></td>   </tr>                          </ItemTemplate>                        </asp:Repeater>obj的值变动时无法传到Repeater1控件里面的PayPrice.text里面。



------解决方案--------------------------------------------------------
document.getElementById('PayPrice'+i).value=obj;

你右键查看源代码看一下ID 是不是已经变了!

看是否可以用 PayPrice.ClientID
  相关解决方案