如何在asp下拉列表中使用标头 [英] How to use header in asp dropdownlist

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

问题描述

asp下拉列表控件应如下所示:



A类

班加罗尔

加尔各答

孟买

B类

德里

海德拉巴

钦奈



这里,不应选择A / B类,只选择我需要选择的值



我想快速帮助PLZ。下拉列表应该是后端动态的(vb.Net)



它可以使用html标签完成,但我希望这可以使用Asp下拉列表控件来完成。

解决方案

本文应该对您有帮助 - 禁用或使ListItem不可选择ASP.Net DropDownList使用jQuery [ ^ ]。它提供了您需要的确切解决方案。

类似的问题也被问到这里 [之前 ^ ]。


< blockquote>

 <   asp:GridView     ID   =  gvCustomers     runat   = < span class =code-keyword> server   宽度  =  550px  

AutoGenerateColumns = false

字体名称 = Arial < span class =code-attribute> 字体大小 = 11pt AlternatingRowStyle-BackColor = #C2D69B

HeaderStyle-BackColor = green

AllowPaging = true ShowFooter = true OnPageIndexChanging = OnPaging PageSize = 10 >
< >
< asp:BoundField HeaderText = CustomerID DataField = CustomerId FooterText = 页脚 / >
< asp:BoundField HeaderText = 联系人姓名 DataField = ContactName FooterText = 页脚 / >
< asp:BoundField HeaderText = 公司名称 DataField = CompanyName FooterText = 页脚 < span class =code-attribute> / >
< / Columns >
< AlternatingRowStyle BackColor = # C2D69B / >
< / asp:GridView > ;


the asp dropdownlist control should look like :

Category A
Bangalore
Kolkata
Mumbai
Category B
Delhi
Hyderabad
Chennai

here , the "Category A/B" should not be selected, only the values i need to select

I want quick help plz. The dropdownlist should be dynamic from backend (vb.Net)

it can be done using html tags, but i want this to be done using Asp dropdownlist control.

解决方案

This article should help you - Disable or Make a ListItem Non selectable ASP.Net DropDownList Using jQuery[^]. It provides the exact solution you need.
A similar question was also asked here[^] before.


<asp:GridView ID="gvCustomers" runat="server" Width="550px"

AutoGenerateColumns="false"

Font-Names="Arial" Font-Size="11pt" AlternatingRowStyle-BackColor="#C2D69B"

HeaderStyle-BackColor="green"

AllowPaging="true" ShowFooter="true" OnPageIndexChanging="OnPaging" PageSize="10">
<Columns>
    <asp:BoundField HeaderText="CustomerID" DataField="CustomerId" FooterText="Footer" />
    <asp:BoundField HeaderText="Contact Name" DataField="ContactName" FooterText="Footer" />
    <asp:BoundField HeaderText="Company Name" DataField="CompanyName" FooterText="Footer" />
</Columns>
<AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>


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

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