Take tag from the master page from another .aspx

0

How do I do it so that I can take a tag from the master page and put it in hidden by means of a .hide (), when a user logs in? To verify the logeo I use c #, something of this style:

if (usuario.nombre==Login.text){

ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>$('#id_login').hide;</script>");

But this does not work for me because the #id_login is on the master page and it does not take it from here. What I want to do is hide where it says Start session once the session has been started correctly. And that tag is on the master page that contains the common "header" of all project .aspx

    
asked by wuasaa 13.12.2016 в 01:57
source

1 answer

1

When you use the master page the ids assigned to the controls are renamed by asp.net, that's why using the id directly does not work

If the idea is to use jquery you could select by approximation using

string script = "$(\"[id*='id_login']\").hide();";
ClientScript.RegisterStartupScript(this.GetType(), "myScript", script, true);

in jquery the *= is a selecotr of like in this case use the id

If you inspect the html using the browser's Developr Tools, which you access with F12, you can see that id sign asp.net to this control you want to select

    
answered by 13.12.2016 / 03:49
source