locked
C# web forms , mouse in and out RRS feed

  • Question

  • Hi all,

    In C# web forms, how to make mouse in a label, and the label text is visible, and mouse leave the label, label text is invisible?

    Thank you,
    Ling
    • Moved by Harry Zhu Friday, November 27, 2009 7:32 AM (From:Visual C# General)
    Thursday, November 26, 2009 1:10 AM

Answers

  • Hi,

    Sorry, I misread your question.You may try your question on forums.asp.net. Thanks.
    Hi, I am Kyi.
    • Marked as answer by Blueberry70 Friday, November 27, 2009 8:35 AM
    Thursday, November 26, 2009 5:30 AM
  • Hi,

    For the
    questions relating to asp.net ,please post to: http://forums.asp.net/.

    Thanks,
    Harry


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Blueberry70 Friday, November 27, 2009 8:35 AM
    Friday, November 27, 2009 7:32 AM

All replies

  • Hi,

    Try this below. Hope it helps you. Thanks.

    public Form2()
            {
                InitializeComponent();
               
                label1.MouseMove += new MouseEventHandler(label1_MouseMove);
                label1.MouseLeave += new EventHandler(label1_MouseLeave);
            }

            void label1_MouseMove(object sender, MouseEventArgs e)
            {     
                    label1.Visible = true;
            }

            void label1_MouseLeave(object sender, EventArgs e)
            {
                label1.Visible = false;
            }
    Hi, I am Kyi.
    Thursday, November 26, 2009 2:23 AM

  • I think label1.MouseMove is for C# windows forms, I am actually expecting something for web forms, much appreciated.

    Ling
    Thursday, November 26, 2009 4:23 AM
  • This has the potential to become a pretty heavy undertaking without knowing exactly what you are after. 

    For instance, are there multiple controls conveying this behavior?  Is this being Form submitted?  Assuming so, is the previous value supposed to be posted?  Is there a starting value of the textbox?  If so, is this value databound in anyway?  Do your controls get validated?

    Any one of these things can shift the direction we'd lead you signifigantly.  If you could give us some of the code you currently have in place and a little more of the behavior you'd expect - that'll potentially save everyone involved a ton of time and frustration.
    Thursday, November 26, 2009 4:47 AM
  • Hi ,

    I am creating a table, details as below:

    <table>
    <tr>
    <td>
    <asp: Label ID="lbl_1" runat="server" Text="showWhenMouseOn"></asp:Label>
    </td>
    </tr>
    </table>

    I want the label text "showWhenMouseOn" only appear when mouse move on the label , and disappear when mouse moves out of the label.

    Thank you,
    Ling
    Thursday, November 26, 2009 5:12 AM
  • Hi,

    Sorry, I misread your question.You may try your question on forums.asp.net. Thanks.
    Hi, I am Kyi.
    • Marked as answer by Blueberry70 Friday, November 27, 2009 8:35 AM
    Thursday, November 26, 2009 5:30 AM
  • You didn't answer a single one of the follow up questions I asked...

    1. I assume at some point - you want the server to be aware of this invisible value, right - we're not just clearing out anything the user puts in?  So how is it being sent to the server from the client?
    2. Also - is there only one instance of this kind of behavior or will this apply to a handful of textboxes on this page?
    3. Lastly, when the page first renders - is there a value being given to the control.  In your last less-than-helpful reply - it would appear that there is as a string literal.  However, I wonder if the reasoning for this is solely due to your taking it out of the context of the issue.

    Please answer the above 3 questions individually and clearly; then I, and others here, will be happy to help you.

    Thursday, November 26, 2009 5:35 AM
  • Hi,

    For the
    questions relating to asp.net ,please post to: http://forums.asp.net/.

    Thanks,
    Harry


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Blueberry70 Friday, November 27, 2009 8:35 AM
    Friday, November 27, 2009 7:32 AM