show hide image button

Discussion in 'ASP .Net Web Controls' started by TJS, Nov 8, 2003.

  1. TJS

    TJS Guest

    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>
     
    TJS, Nov 8, 2003
    #1
    1. Advertising

  2. TJS

    Jos Guest

    TJS wrote:
    > 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.

    --

    Jos Branders
     
    Jos, Nov 9, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dje
    Replies:
    5
    Views:
    1,700
    =?Utf-8?B?Q2hyaXM=?=
    Dec 2, 2004
  2. Shapper

    Image Button and Show/Hide Panel

    Shapper, Sep 21, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    10,299
    Shapper
    Sep 21, 2005
  3. =?Utf-8?B?Sm9l?=

    Show Details/Hide Details link button

    =?Utf-8?B?Sm9l?=, Mar 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    910
    dkode
    Mar 13, 2006
  4. Mic
    Replies:
    5
    Views:
    13,559
    Alexey Smirnov
    Aug 31, 2007
  5. ll
    Replies:
    2
    Views:
    652
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page