Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to Hide one element and show another
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Client-side développement
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01302771
Message ID:
01302773
Vues:
7
>Hi everybody,
>
>Thanks to Paul I got the first part of my page working (or at least it seems to work in few tests I made).
>
>Now I'm up to the next "challenge".
>
>When I click on Edit button in my grid I show user's info in a separate table and hide the grid. I have Save button with server code and I have a Cancel button, which, I believe, should only hide the table and show the grid.
>
>So, I'm trying the following code in Page_Init (what better method should I use - this one fires too often)?
>
>
>protected void Page_Init(object sender, EventArgs e)
>    {
>        this.btnCancelProfile.Attributes["onclick"] =
>"HideElement('" +
>this.tblProInfo.ClientID +
>"');ShowElement('" + this.grdvwUsers.ClientID + "');" ;
>    }
>
>However, the Hide part seems to be working, but the show part doesn't.
>
>Here is my code in Master.js file (which I added to Master page):
>
>
>function HideElement(what)
>{
>alert(what);
>var x = document.getElementById(what);
>alert(x);
>if (x) {
>  x.style.display = 'none' ;
>  }
>  return true ;
> }
> function ShowElement(what)
>{
>alert(what);
>var x = document.getElementById(what);
>alert(x);
>if (x) {
>  x.style.visibility='visible'; ;
>  }
>  return true ;
> }
>
>Do you see what is wrong?
>
>Thanks in advance.

Here is what I see in FireBug for this button (the code doesn't work):
<input type="button" style="border: 
1px solid rgb(204, 204, 204); 
color: rgb(40, 71, 117); background-color: rgb(255, 251, 255); 
font-family: Verdana; font-size: 0.8em;" id="ctl00_ContentPlaceHolder1_btnCancelProfile" 
onclick="HideElement('ctl00_ContentPlaceHolder1_tblProInfo');
ShowElement('ctl00_ContentPlaceHolder1_grdvwUsers');
__doPostBack('ctl00$ContentPlaceHolder1$btnCancelProfile','')" 
value="Cancel" 
name="ctl00$ContentPlaceHolder1$btnCancelProfile"/>
We don't need a PostBack, how can I make it?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform