ASP.NET提示确实与空字符串不取消设置 [英] ASP.NET tooltip doesn't unset with empty string

查看:77
本文介绍了ASP.NET提示确实与空字符串不取消设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TextBox元素,它具有工具提示的HTML设置为一些文字(使用标题属性)。作为事件的结果,我想从我的服务器 - code删除文本框工具提示。

I have a TextBox element, which has the Tooltip set in the HTML to some text (using the 'title' attribute). As a result of an event, I want to remove this tooltip from the TextBox from my server-code.

要做到这一点,我想取消设置ASP.NET ToolTip属性,例如

To do this, I tried to unset the ASP.NET ToolTip property, e.g.

myTextBox.ToolTip = ""; 
//or
myTextBox.ToolTip = String.Empty;
//or
myTextBox.ToolTip = null;

然而,当回发完成后,我发现,在提示文本保持原样,所以我认为这将是它没有走光。

However, when the postback is finished, I find that the text on the tooltip remains as it was, so it wasn't emptied as I thought it would be.

奇怪的是,我发现我能虽然改变提示的值。例如,如果,我只是进入了一个空白,例如

Curiously, I found I was able to change the value of the tooltip though. If for example, I just entered a blank space, e.g.

myTextBox.ToolTip = " ";

然后坐在回发事件完成,工具提示显示出来就盘旋在文本框中,但它的空白。这仍然是,虽然我当用户尝试输入文本框不希望空提示漂浮的一个问题。

Then upon the postback event completing, the tooltip shows up on hovering over the text box, but it's blank. This is still a problem though as I don't want an empty tooltip floating around while the user tries to enter text into the box.

我要如何摆脱使用C#ASP.NET服务器code中的提示呢?可能吗?

How do I get rid of the tooltip using C# ASP.NET server code? Is it possible?

感谢

推荐答案

解决方法是删除标题属性,像这样:

The solution is to remove the 'title' attribute, like so:

myTextBox.Attributes.Remove("title");

这篇关于ASP.NET提示确实与空字符串不取消设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆