Making Edit Linkbutton invisble in repeater using Javascript function RRS feed

  • Question

  • User-1578974752 posted


    I have  4 link buttons and few textboxes inside the repeater panel.When i click Edit link button i want to make the Edit Link button invisble and show the Update link button.Textbox is retrieved as below code but  when tried like this with link button error is showing.Thanks


    function MyFunction(e) {

    var tex11 = e.parentNode.getElementsByTagName("input")[0];    

    var tex12 = e.parentNode.getElementsByTagName("input")[12];

     tex11.disabled ="";

     tex12.disabled ="";





    Thursday, November 14, 2013 10:23 PM


  • User-417640953 posted

    Hi shsu,

    Thank you post the issue to asp.net forum.

    From your description, I see that you want to show the update linkbutton and hide the edit linkbutton and disable the textbox

    when click the edit link button. For this issue, I made a simple demo below.

    <head runat="server">
            function MyFunction(e) {
                var tex11 = e.parentNode.getElementsByTagName("input")[0];
                var link1 = e.parentNode.getElementsByTagName("a")[1];
                tex11.disabled = "";
                link1.style.display = "block";
                e.style.display = "none";
        <form id="form1" runat="server">
            <asp:Repeater ID="Repeater1" runat="server">
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%#Eval("Name") %>' disabled="disabled"></asp:TextBox>
                    <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="MyFunction(this); return false;">Edit</asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server"  style="display:none">Update</asp:LinkButton>

    Code behind:

     protected void Page_Load(object sender, EventArgs e)
                //test data
                DataTable dt = new DataTable();
                this.Repeater1.DataSource = dt;

    Hope this helps. Thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 18, 2013 12:33 AM