如何在asp.net中的下拉列表中填入长文本 [英] How to populate long text in dropdownlist in asp.net

查看:96
本文介绍了如何在asp.net中的下拉列表中填入长文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在asp.net中,我尝试使用非常长的文本填充一个下拉列表框。我已经修复了页面上的列表宽度,我不想改变它的大小,因为它会影响我的页面布局。单击下拉列表时,文本将被截断为下拉列表的大小。我想看到整个文本没有任何截断,而不改变下拉列表框的大小。还有如果有任何第三方控件可以解决这个问题?如果有一个解决方案将是非常有益的。



更新:



现在正在Jquery中尝试一个下拉框,如果它超过size再次,问题是在独立解决方案上工作正常,但是当我将其与我的应用程序集成在一起时,它不会读取.css文件,并且不会按照它应该做的任何格式化(样式,字体,对齐) .css文件。为什么会发生这种情况?

解决方案

您可能可以使用jQuery来创建一个工具提示



  //这在页面加载时执行 - 就像asp.net Page_load()
函数pageLoad(){
//附加鼠标悬停t到你的下拉列表中的每个选项
$(#myDropdown选项)。mouseover(function(){
//从该选项获取文本
var text = $(# + this.id)的.text();
//在小工具提示中显示文本
showToolTip(text);

});

}

函数showToolTip(text){
//以某种方式显示
}
/ pre>

有一个名为 wz_tooltip 的javascript库可在 walterzorn.com



希望有助于


In asp.net, am trying to populate a dropdownlist box with very long text. I have fixed the width of list on the page and i don't want to change its size as it would affect my page layout. On clicking the dropdownlist, the text gets truncated to the size of the dropdown. I want to see the entire text without any truncation, without changing the size of the dropdownlist box..Also if there are any third party controls which would solve this problem?Would be very helpful if there's a solution for this.

Update:

Right now am trying a dropdown box in Jquery that will wrap the text if it exceeds the size..but again the problem is it works fine on an independent solution but when i integrate it with my application, it does not read the .css file and it does not do any formatting(style, font, alignment) that it is supposed to do according to the .css file.Any idea why this is happening?

解决方案

You might be able to use jQuery to create a tooltip like thing that appears when you hover over each option.

something like

// this executes on page load - just like asp.net Page_load()
function pageLoad(){
// attach a mouseover event to each option in your dropdown
$("#myDropdown option").mouseover(function(){
      // get the text from that option
      var text = $("#"+this.id).text();
      // display that text in a small tooltip
      showToolTip(text);

});

}

function showToolTip(text){
     // display in some way
}

there's a javascript library called wz_tooltip available at walterzorn.com

hope that helps

这篇关于如何在asp.net中的下拉列表中填入长文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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