bonniemanila
New Member
I have a asp:listview of Types and Addresses for data in a Database. On button click I change the innerhtml of button to different text and I need to remove the disabled attribute on the corresponding input textbox for type and address. Whats happening is when I click on the button it removes the disabled attribute for the first row in the listview but not for the correponding one for the one I'm clicking. for example heres an example of the listview and what its doingType "/t/t/t/t/t/t/t" AddressTxtBox TxtBoxTxtBoxTxtBox EditBtn DeleteBtnTxtBox TxtBoxTxtBoxTxtBox EditBtn DeleteBtn /**for example if i clicked this edit button it would remove the disable from the record above not this rowTxtBox TxtBoxTxtBoxTxtBox EditBtn DeleteBtn\[code\]<script type="text/javascript"> function changeText(button) { button.innerHTML="Save"; document.getElementById('Type').removeAttribute('disabled'); document.getElementById('Address').removeAttribute('disabled'); </script><body> <div>Addresses</div> <br /> <div> <asp:ListView runat="server" ID="ListView1" > <EmptyDataTemplate>No records found.</EmptyDataTemplate> <LayoutTemplate> <table id="sort" style="border:solid 1px black;width:40%;"> <thead> <tr> <th> <a href="http://stackoverflow.com/questions/14616879/#">Type</a> </th> <th> <a href="http://stackoverflow.com/questions/14616879/#">Address</a> </th> </tr> </thead> <tbody> <tr id="itemPlaceholder" runat="server" /> </tbody> <tfoot> </tfoot> </table> </LayoutTemplate> <ItemTemplate> <tr> <td> <input size="8" type="text" ID="Type" disabled="disabled" value="http://stackoverflow.com/questions/14616879/<%# Eval("Type")%>" /> </td> <td> <input size="9" type="text" ID="Address" disabled="disabled" value="http://stackoverflow.com/questions/14616879/<%# Eval("street")%> <%# Eval("City")%> <%# Eval("State")%>" /> </td> <td> <button id="editBtn" type="button" onclick="changeText(this)">Edit</button> </td> </tr> </ItemTemplate> </asp:ListView> </div>\[/code\]