asp.net 的ComboBox 可输入可选择下拉列表
文章出处:http://www.cnblogs.com/ejiyuan/archive/2007/11/09/954325.html
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Collections;
using System.Web.UI.Design;
[assembly: TagPrefix("AtomNet.Web.UI.WebControls", "AtomNet")]
namespace AtomNet.Web.UI.WebControls
{
/// <summary>
/// Represents a control that allows the user to select a single item from a drop-down list,
/// or type in a new value that is not in the list.
/// </summary>
/// <remarks>
/// Since the ComboBox control inherits from <see cref="System.Web.UI.WebControls.ListBox"/>,
/// you can use it in exactly the same manner (including DataBinding).
/// For older browsers that do not support the functionality required to render this control,
/// a normal dropdown box will be emitted instead.
/// </remarks>
[ToolboxData("<{0}:ComboBox runat=\"server\"></{0}:ComboBox>")]
[ValidationPropertyAttribute("SelectedValue")]
[Designer(typeof(AtomNet.Web.UI.WebControls.ComboBoxDesigner))]
public class ComboBox : System.Web.UI.WebControls.ListBox
{
#region 私有属性
/// <summary>
/// The <see cref="System.Web.UI.WebControls.TextBox"/> used internally to allow the user
/// to type in new values.
/// </summary>
TextBox textBox = new TextBox();
相关文档:
javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElement;
var objs = document.getElementsByTagName('INPUT');
for(var i=0; i< objs.length; i++)
{
if(objs[i].type.toLowerCase() == 'submit')
{
objs[i].disabled = true;
}
}
......
1、数据控件(如DataGrid/DataList等控件)格式化日期方法:
e.Item.Cell[0].Text = Convert.ToDateTime(e.Item.Cell[0].Text).ToShortDateString();
//指定列(第1列)格式化日期
2、用String类转换日期显示格式:
String.Format( "yyyy-MM-dd ",yourDateTime);
3、用Convert方法转换日期显示格式:
Convert.ToDat ......
验证可以确保用户输入符合您指定的条件。在大多数情况下,这一操作比较简单。但有时对输入进行验证会引入特殊的条件。了解这些条件是什么、验证如何执行以及有哪些可能的验证结果是非常重要的。
一、与空白字段的对比
如果字段为空白,则除 RequiredFieldValidator 控件之外的 ......
Asp.net设计时经常要在.aspx.cs代码中写一些脚本,每次都重新写比较麻烦,所以把经常用的整理了一下,写成一个公共类,以便以后调用.
using System.Text;
using System.Web;
using System.Web.UI; namespace Lmsoft.Net.Web
{
/**//// <summary>
/// 文件名: Js.cs ......