Click here to Skip to main content
15,900,108 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I've seen many posts about people trying to change the text via javascript after a linklabel was clicked but I cant seem to find one that helps me.

please look at my code below and assist where possible. The texts stays the same no matter what I try.

ASP.NET
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="TestApp._Default" %>


<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type = "text/javascript">
    function DisableButton() {
        document.getElementById('<%= SubmitButton.ClientID %>').InnerText = 'hidden';
        document.getElementById('<%= SubmitButton.ClientID %>').Text = 'text';
        document.getElementById('<%= SubmitButton.ClientID %>').InnerHTML = 'html';
        document.getElementById('<%= SubmitButton.ClientID %>').value = 'val';
    }

</script>
    <h2>
        Welcome to ASP.NET!
    </h2>
    <p>
                                <asp:LinkButton ID="SubmitButton" runat = "server" onclientclick="DisableButton()" >
                                    Click
                                </asp:LinkButton>
    </p>
Posted

Hi,

Try innerText/innerHTML instead of InnerText/InnerHTML.

Or try this: http://www.permadi.com/tutorial/jsInnerHTMLDOM/index.html[^]

Hope it helps.
 
Share this answer
 
v3
Hi Popstarr
have you tried to coding over codebehind?
i mean

VB
Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitButton.Click
       Me.SubmitButton.Text = "TextChanged"
   End Sub


try this
i hope this way help you.

Regards
 
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