我可以在使用的工具提示中断行 [英] Can I break lines in tooltip used

查看:54
本文介绍了我可以在使用的工具提示中断行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,因为我正在使用工具提示来显示描述,每当用户将鼠标悬停在使用工具提示的特定单元格时,它会显示包含许多行的描述,因为它显示所有单行,我希望它在显示时断行工具提示



 protected void gvDetails_RowDataBound(object sender,GridViewRowEventArgs e)
{
DataControlRowType rtype = e.Row.RowType ;
if(rtype == DataControlRowType.DataRow&& rtype!= DataControlRowType.Footer
&& rtype!= DataControlRowType.Separator&& rtype!= DataControlRowType.Header
&& rtype!= DataControlRowType.Pager)
{
Label lbl =(Label)e.Row.FindControl(lblremark);
Label lbl1 =(Label)e.Row.FindControl(empname);
e.Row.Cells [5] .ToolTip = lbl.Text;
e.Row.Cells [0] .ToolTip = lbl1.Text;
}





我的尝试:



标签lbl =(标签)e.Row.FindControl(lblremark); 
Label lbl1 =(Label)e.Row.FindControl(empname);
e.Row.Cells [5] .ToolTip = lbl.Text;
e.Row.Cells [0] .ToolTip = lbl1.Text;





我从网格中使用的lblremark中选择描述,在gridview中通过empname选择employeedetails任何人都可以帮助

解决方案

是 - 工具提示服从\\\\ n字符并从新行开始。

所以

 myObject .ToolTip =  第1行\\ nLine 2 \\ nnLine 3; 

将正常工作。


为了在控件中显示换行符,您需要进行一些实验。

即使在网络上也是如此,< br>不能在警报中工作,你需要使用\ n。



所以,用各种类型的换行符进行测试:\ n \ n \ r等等。



或者 - 你可以google它。 。 。结果

Hi every one, As i am using tooltip to show description,whenever user mouse over particular cell that using tool tip its shows description that contains many lines,as it shows all in single row i want it to break lines while showing in tooltip

protected void gvDetails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataControlRowType rtype = e.Row.RowType;
        if (rtype == DataControlRowType.DataRow && rtype != DataControlRowType.Footer
            && rtype != DataControlRowType.Separator && rtype != DataControlRowType.Header
       && rtype != DataControlRowType.Pager)
        {
            Label lbl = (Label)e.Row.FindControl("lblremark");
            Label lbl1=(Label)e.Row.FindControl("empname");
            e.Row.Cells[5].ToolTip = lbl.Text;
            e.Row.Cells[0].ToolTip = lbl1.Text;
        }



What I have tried:

Label lbl = (Label)e.Row.FindControl("lblremark");
           Label lbl1=(Label)e.Row.FindControl("empname");
           e.Row.Cells[5].ToolTip = lbl.Text;
           e.Row.Cells[0].ToolTip = lbl1.Text;



I am picking description from lblremark used in grid and employeedetails by empname in gridview can anyone help

解决方案

Yes - ToolTips obey "\r\n" characters and start on a new line.
So

myObject.ToolTip = "Line 1\r\nLine 2\r\nLine 3";

will work fine.


In order to show line-breaks in controls you need to experiment a bit.
Even on the web, <br> doesn't work in an alert, you need to use \n.

So, do a test with various types of line breaks: \n \n\r and so forth.

Or - you could google it . . .


这篇关于我可以在使用的工具提示中断行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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