Link to home
Start Free TrialLog in
Avatar of Rajar Ahmed
Rajar AhmedFlag for India

asked on

how to hide details for a particular user..?

i logged in by the user, which shows the page......

i created , a page which retrives details from db , the page has several field
such as name, email etc..,like that the page ll be repeated with data from the tables for different id..
Now i need to add  two buttons show and hide . which should follows its requirments
i mean , show should be able see for that user , hide , should restricts that name to the  user........
i need idea how to do this ..
Avatar of billyholliday
billyholliday

Please explain clearer what you want to do.

Do you have code you can post and comment on that what you want to do? Are you trying to hide information based on which user logs in?

Cheers
Avatar of Rajar Ahmed

ASKER

its a admin panel, where i have a fields of name ,email ...now i have to give appropritate prority  to that user who will be logged in ,.so, i need two buttons namely show, hide ...if i click show e can c those details when e logged in ..but if i give hide e cant see dat details....


name adfas                          Show(button) hide(button)
email  dsafd@fds.com

name dsaf                           Show(button) hide(button)
email  fdsaf@dfs.com


if show is clicked, he can see .but if hide is clicked he cant see..

how can i do this..???


ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ders no form , i need button inside this statemt..


Response.Write("<table ><tr><td >Name : </td><td>"&rs(0)&"</td><td ><tr><td align='right'>Email ID : </td><td>"&Rs(1)&"</td></tr><tr><td align='right'></table>")
 
Like this.....
name adfas                          Show(button) hide(button)
email  dsafd@fds.com 

Open in new window

No need of form tag

try this with above javascript function

Response.Write("<table ><tr><td >Name : </td><td>"&rs(0)&"</td><td ><tr><td align='right'>Email ID : </td><td>"&Rs(1)&"</td></tr><tr><td align='right'><input id='Button1' name='btnShow'  type='button' value='Hide' onclick='test()'></td></table>")
i found hide button on my page, but there was no action...
it doesnot change to show..
as it did in dat sample which u provided b4..

Try like this .

you need to give id to each TR and then pass it from test function like below

<script language="javascript" type="text/javascript"   >
function test(trname)
{
if ( document.getElementById("btnShow").value == "Hide" ) {

document.getElementById(trname).style.display  = "none"
document.getElementById("btnShow").value = "Show"
}
else
{
document.getElementById(trname).style.display  = "block"
document.getElementById("btnShow").value = "Hide"
}

}
</script>



Response.Write("<table ><tr id = 'testtr'><td >Name : </td><td>"&rs(0)&"</td><td ><tr><td align='right'>Email ID : </td><td>"&Rs(1)&"</td></tr><tr><td align='right'><input id='Button1' name='btnShow'  type='button' value='Hide' onclick='test('testtr')'></td></table>")
Try like this .

you need to give id to each TR and then pass it from test function like below

<script language="javascript" type="text/javascript"   >
function test(trname,trname1)
{
if ( document.getElementById("btnShow").value == "Hide" ) {

document.getElementById(trname).style.display  = "none"
document.getElementById(trname1).style.display  = "none"
document.getElementById("btnShow").value = "Show"
}
else
{
document.getElementById(trname).style.display  = "block"
document.getElementById(trname1).style.display  = "none"
document.getElementById("btnShow").value = "Hide"
}

}
</script>



Response.Write("<table ><tr id = 'testtr'><td >Name : </td><td>"&rs(0)&"</td><td ><tr id = 'testtr1'><td align='right'>Email ID : </td><td>"&Rs(1)&"</td></tr><tr><td align='right'><input id='Button1' name='btnShow'  type='button' value='Hide' onclick='test('testtr','testtr1')'></td></table>")
r u wanting to setup a admin feature where each user is listed and then u can say whether to hide details for each use or not?
S ....
i mean .....as u ve said....i want to give appropriate preference to list of users .
 if i logged in by a user . i should see a hide / show buton . when i click hide button then the details should be hidden for that particular user . the hide button should change toshow..

what programming  language r u using? I c in your post some tags but need to know exactly

cheers
ASP, VB script.
what details r u wanting to hide?
have you tried code in my last comment ? is it working?