show hide image button

T

TJS

I want to change visiblity of an image button based upon user selection in a
drop list
using sub below but it is not making the image visibility change when the
droplist selection changes,
what is missing ?????

....

Sub dropUsersSelInxChng(s As Object, e As EventArgs)
if allUsers.SelectedItem.Value = "1" then
Imagebutton2.Visible="False"
else
Imagebutton2.Visible="True"
end if
End Sub

....

<asp:DropDownList OnSelectedIndexChanged="dropUsersSelInxChng"
id="allUsers" runat="server" DataTextField="Email"
DataValueField="UserID"></asp:DropDownList>

<asp:ImageButton id="Imagebutton2" Visible="true"
onclick="DeleteUser_Click" runat="server" ImageUrl="~/images/delete.gif"
AlternateText="Delete this user"></asp:ImageButton>
 
J

Jos

TJS said:
I want to change visiblity of an image button based upon user
selection in a drop list
using sub below but it is not making the image visibility change when
the droplist selection changes,
what is missing ?????

...

Sub dropUsersSelInxChng(s As Object, e As EventArgs)
if allUsers.SelectedItem.Value = "1" then
Imagebutton2.Visible="False"
else
Imagebutton2.Visible="True"
end if
End Sub

...

<asp:DropDownList OnSelectedIndexChanged="dropUsersSelInxChng"
id="allUsers" runat="server" DataTextField="Email"
DataValueField="UserID"></asp:DropDownList>

<asp:ImageButton id="Imagebutton2" Visible="true"
onclick="DeleteUser_Click" runat="server"
ImageUrl="~/images/delete.gif" AlternateText="Delete this
user"></asp:ImageButton>

Set AutoPostback="True" for the DropDownList.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top