Click here to Skip to main content
15,910,872 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm unable to display my label in javascript popup ..

My .CS code is

C#
ViewState["RcNo"] = stat;
      lblRcno.Text = "Receipt No: " + ViewState["RcNo"].ToString();



and my .aspx Code is

XML
function showMessage() {
            confirm(" Are you sure to print ? \n\n" + "      "
            + document.getElementById("<%=lblRcno.ClientID%>").innerHTML)
        }


confirm box is not getting opened on function call
ScriptManager.RegisterStartupScript(Page, typeof(Page), "message", "showMessage();", true);

But when i'm using alert in javascript

XML
function display() {
           alert(("<%=lblRcno.ClientID%>").innerHTML)

       }


its showing undefined
Posted
Updated 24-Feb-14 2:09am
v2
Comments
Sibasisjena 24-Feb-14 9:07am    
Is your control going to showMessage() ?

Replace double quotes
ASP
"<%=lblRcno.ClientID%>"

By single ones
ASP
'<%=lblRcno.ClientID%>'

And add ";" after calling confirm function ;)
JavaScript
confirm(" Are you sure to print ? \n\n" + "      "
            + document.getElementById('<%=lblRcno.ClientID%>').innerHTML);
 
Share this answer
 
my llael is visible false;
i made it visible true

problem solved
 
Share this answer
 
v2

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