首页 > 编程语言 >Displaying multiple columns in a HTML Listbox Control in ASP.Net

Displaying multiple columns in a HTML Listbox Control in ASP.Net

时间:2023-11-08 12:07:44浏览次数:47  
标签:Control Dim ASP multiple dreader tax tm tempspace your

REF:

http://forums.aspfree.com/net-development-11/displaying-multiple-columns-in-a-html-listbos-control-in-asp-19062.html

 

listbox column spacing solution



FINALLY!!! I Know so many people have had this problem. But finally i solved it with your basic mono spacing font type.

As we all know the asp.net listbox has a problem with truncating all added spaces. So you can't create columns with in your listbox. But all your need to do is use the command Sever.HtmlDecode(string) that will send whatever is in inside it directly to html. The problem was there listbox would change the & to amp; so the spaces wouldn't come out. But with this command the & will not get changed. The space html ascii to use would either be   or   just put either inside your Server.HtmlDecode() and your set.. Walla Spacing.......

Here is an example i'm using and Sql server to get data but you should get the idea.

{

Dim dreader As SqlClient.SqlDataReader

Dim sqlcmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("SELECT tm_tax_code, tm_tax_description FROM [Tax-Master] ORDER BY tm_tax_code", conn1)

sqlcmd.Connection.Open()

dreader = sqlcmd.ExecuteReader


Dim TaxCode As String

Dim taxnum As Integer = 8

Dim tempspace As String

Dim ct As Integer

ct = 0


Do While dreader.Read

TaxCode = Trim(dreader("tm_tax_code"))

taxnum -= Len(TaxCode)

For ct = 0 To taxnum

tempspace = tempspace & " "

Next


LstTaxMaster.Items.Add(Trim(dreader("tm_tax_code")) & Server.HtmlDecode(tempspace) & dreader("tm_tax_description"))

tempspace = ""

taxnum = 8

Loop


sqlcmd.Connection.Close()

}


标签:Control,Dim,ASP,multiple,dreader,tax,tm,tempspace,your
From: https://blog.51cto.com/emanlee/8247604

相关文章

  • Current Outdoor Lighting Policies in China: Measures to Control Light Pollution
    AbstractLightpollutionisaseriousenvironmentalissuewithmanyadverseeffectsonhumanhealthandtheecosystemasawhole.Accordingly,manycountrieshaveissuedlawsandregulationstolimittheeffectsofartificiallightingatnight(ALAN).Chin......
  • Asp.Net Core webapi+net6 使用资源筛选器(过滤器) 做缓存
    写一个特性类,用来做标记[AttributeUsage(AttributeTargets.Method)]//只对方法有效publicclassResourceFilterAttribute:Attribute{}我这里使用了MemoryCache来做缓存,也可以使用字典来做,但一定要加上static,否则字典每一次请求都会new一个实例,缓存的东西就丢了private......
  • asp.net中怎样用Javascript控制RequiredFieldValidator控件什么时候启用,什么时候不启
    Enable/DisableRequiredFieldValidatorwithJavascriptdocument.getElementById("requiredfieldvalidatorid").enabled=false;<asp:DropDownListID="ddlServiceName"runat="server"onchange='varDateValidator=docume......
  • ASP.NET性能计数器
       ASP.NET支持两组性能计数器:系统和应用程序。前者在ASP.NET性能计数器对象中的PerfMon中公开;后者在ASP.NETApplications性能对象中公开。ASP.NET性能对象中的StateServerSessions计数器(仅适用于在其中运行状态服务器的服务器计算机)和ASP.NETApplications性能......
  • ASP.NET和Oracle连接问题的解决方法 - Unable to load DLL (oci.dll)
    以下适用于Windows2003:不少人在做ASP.NET+Oracle开发的时候都会碰到连接问题,提示“UnabletoloadDLL(oci.dll)”,但这个文件在系统中是存在的,很多人为此焦头烂额,我看到很多的帖子都是求助这个问题的。其实并非所有的人都会碰到这个问题,只在于用硬盘分区格式为NTFS的用户,既然oci.......
  • Visual Studio 2008安装ASP.NET MVC 2 RTM
    1首先,要安装VisualStudio2008SP1,下载地址http://www.microsoft.com/en-us/download/details.aspx?id=109862下载ASP.NETMVC2RTM(英文版,2.5M,AspNetMVC2_VS2008.exe)下载地址http://www.microsoft.com/en-us/download/details.aspx?id=220793双击AspNetMVC2_VS2008.e......
  • Asp.Net Core实战(干货)
    序言使用.NETCore,团队可以更容易专注的在.netcore上工作。比如核心类库(如System.Collections)的更改仍然需要与.NETFramework相同的活力,但是ASP.NETCore或EntityFrameworkCore可以更轻松地进行实质性更改,而不受向后兼容性的限制。.NETCore借鉴了.NETFramework的最佳实践,并......
  • UniPageControl1的Tab高度调整(69)
    .x-tab.x-tab-active.x-tab-inner-default{color:#FF0000!important;height:40px!important;line-height:40px}  ......
  • 在ASP.NET MVC框架中,如何处理多个提交按钮?
    内容来自DOChttps://q.houxu6.top/?s=在ASP.NETMVC框架中,如何处理多个提交按钮?在ASP.NETFrameworkBeta中,有几种方法可以处理同一表单中的多个提交按钮。一种方法是使用一个隐藏字段来区分不同的提交按钮。例如:<%Html.BeginForm("MyAction","MyController",FormMethod......
  • Tmux终端复用器(terminal multiplexer)使用教程
    Tmux基础用法会话与进程¶命令行的典型用法是打开终端(terminal)后,在里面输入指令。用户的这种与计算机交互的手段,称为会话(session)。在会话中,通过命令行启动的所有进程均与会话进程绑定。当会话进程终止时,该会话启动的所有进程也会随之强行结束。一点最常见的例子就是通过SSH连......