Author: Meng will come from: [Meng] will be the best of the world
WebdropDownList.aspx
<%
@ Page Language
=
"
C #
"
Codebehind
=
"
WebdropdownList.aspx.cs
"
ValidateRequest
=
"
False
"
Autoeventwireup
=
"
False
"
Inherits
=
"
EMENG.WEBDROPDOWNLIST
"
%>
<
HTML
>
<
HEAD
>
<
Title
>
Simulated drop-down list box
Title
>
<
Meta http
-
Equiv
=
"
Content-Type
"
Content
=
"
TEXT / HTML; Charset = GB2312
"
>
<
Style
>
Body
{FONT: 12PX Song}
TD
{FONT: 12PX Song}
Div
{FONT: 12PX Song}
Label
{Padding-Right: 0px; padding-left: 4px; padding-bottom: 0px; padding-top: 3px; height: 19px}
.LINK_BOX
{CURSOR: Default; Text-Align: Left}
.LINK_HEAD
{Border-Right: 2PX INSET; border-top: 2px INSET; Border-Left: 2px INSET; Width: 100%; Border-Bottom: 2px INSet; Height: 23px}
.LINK_TEXT
{Padding-Left: 2px; Background: #fff}
.LINK_ARROW0
{Border-Right: 2px outset; BiRDER-TOP: 2PX OutSet; Background: Buttonface; font: 14px marlett; border-left: 2px outset; width: 22px; border-bottom: 2px outset; Height: 100%; Text-align : Center}
.LINK_ARROW1
{BORDER-RIGHT: buttonshadow 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: buttonshadow 1px solid; PADDING-LEFT: 2px; BACKGROUND: buttonface; PADDING-BOTTOM: 0px; FONT: 14px marlett; BORDER-LEFT: buttonshadow 1px Solid; Width: 22px; padding-top: 2px; border-bottom: Buttonshadow 1PX Solid; Height: 100%; Text-Align: center}
. LINK_VALUE
{Border-Right: 1PX Solid; Border-Top: 1px Solid; Filter: Alpha (Opacity: 0); Visibility: Hidden; overflow-x: hidden; overflow: auto; border-left: 1px solid; border-bottom: 1px Solid; Position: absolute}
.LINK_RECORD0
{Border-top: #eee 1px solid; padding-left: 2px; Background: #fff; width: 100%; color: # 000; height: 20px} .link_record1
{Border-top: # 047 1px solid; padding-left: 2px; Background: # 058; width: 100%; Color: # fe0; height: 20px}
Style
>
<
Script
>
VAR DROPSHOW
=
False
VAR CurrentidFunction Dropdown (EL)
{if (dropshow) {dropfadeout ()} else {currentid = ELEL.Style.visibility = "visible" DROPFADEIN ()}}
Function Dropfadein ()
{// menu fade effect if (currentID.filters.alpha.opacity <100) {currentID.filters.alpha.opacity = 20fadeTimer = setTimeout ( "dropFadeIn ()", 50)} else {dropShow = trueclearTimeout (fadeTimer)} }
Function Dropfadeout ()
{// Menu Fade Effect if (currentid.filters.alpha.opacity> 0) {Cleartimeout (fadetimer) currentid.filters.alpha.opacity- = 20fadetimer = setTimeout ("Dropfadeout ()", 50)} else {Dropshow = FalsecurrentId.style.visibility = "hidden"}}
Function DropdownHide ()
{IF (Dropshow) {dropfadeout () Dropshow = false}}
Function Hilight (EL)
{// High-brightness display index position if (Dropshow) {for (i = 0; i Function Checkme (EL) {// Replace display content Document.all.Text1.innertext = El.innertext} Document.onclick = Dropdownhide Script > HEAD > < Body Text = " # 000000 " Online = " Document.all.form1.reset () " > < Div Style = " Padding: 10px; border-bottom: 2px solid red " > Simulation drop-down frame Div > < Form ID = " Form1 " OnSubmit = " Alert (city.value) " Runat = " Server " > < TABLE > < TR > < TD > < Div Class = " LINK_BOX " Onsentstart = " Return False " Style = " Width: 100px " > < Div Class = " LINK_HEAD " Onclick = " Dropdown (Value1) " > < Table Height = " 100% " Cellspacing = " 0 " Cellpadding = " 0 " Width = " 100% " Border = " 0 " > < TR > < TD > < Div Class = " LINK_TEXT " > < NOBR > < Label ID = " TEXT1 " > please choose? label > NOBR > Div > TD > < TD align = " Right " Width = " twenty two " > < Div OnMouseup = " this.classname = 'link_arrow0' " Class = " LINK_ARROW0 " OnMouseDown = " this.classname = 'link_arrow1' " OnMouseout = " this.classname = 'link_arrow0' " > 6 Div > TD > TR > TABLE > Div > < Div Class = " Link_Value " id = " Value1 " Style = " Width: 500px; Height: 300px " > < ASP: DataGrid ID = " DataGrid1 " Runat = " Server " AutogenerateColumns = " False " Font - Size = " 12px " Width = " 100% " Showheader = " False " > < Columns > < ASP: BoundColumn Datafield = " Title " Sortexpression = " Title " DataFormatString = " {0} " > ASP: BoundColumn > < ASP: BoundColumn Datafield = " CreateDate " Sortexpression = " CreateDate " Headertext = "" DataFormatString = " {0: YYYY year MM month DD day} " > ASP: BoundColumn > Columns > ASP: DATAGRID > < DIV ID = " MX " > < Div Class = " LINK_RECORD0 " OnMouseover = " Hilight (this) " Onclick = " Checkme (this); Document.all.form1.city.value = this.innertext " > < label > Beijing label > Div > < Div Class = " LINK_RECORD0 " OnMouseover = " Hilight (this) " Onclick = " Checkme (this); Document.all.form1.city.value = this.innertext " > < label > Shanghai label > Div > < Div Class = " LINK_RECORD0 " OnMouseover = " Hilight (this) " Onclick = " Checkme (this); Document.all.form1.city.value = this.innertext " > < label > Henan Province label > Div > < Div Class = " LINK_RECORD0 " OnMouseover = " Hilight (this) " Onclick = " Checkme (this); Document.all.form1.city.value = this.innertext " > < label > Shenzhen label > Div > < Div Class = " LINK_RECORD0 " OnMouseover = " Hilight (this) " Onclick = " Checkme (this); Document.all.form1.city.value = this.innertext " > < label > Dalian label > Div > < Div Class = " LINK_RECORD0 " OnMouseover = " Hilight (this) " Onclick = " Checkme (this); Document.all.form1.city.value = this.innertext " > < label > Yunnan Province label > Div > Div > Div > Div > TD > < TD > < Input Type = " Hidden " Value = " You have not selected " Name = " CITY " > < Input Type = " Submit " Value = " determine " > TD > TR > TABLE > FORM > Body > HTML > WebdropdownList.aspx.cs Using System; Using System.collections; Using System.componentmodel; Using System.data; Using System.drawing; Using System.Web; Using System.Web.SessionState; Using System.Web.ui; Using System.Web.ui.WebControls; Using System.Web.ui.htmlControls; Using System.Data.OleDb; Namespace EMENG {/ ** //// /// summary> public class WebDropDownList: System.Web.UI.Page {protected System.Web.UI.WebControls.DataGrid DataGrid1; private void Page_Load (object sender, System.EventArgs e) {DataGrid1.Columns [0] .ItemStyle.Width = Unit.pixel (400); dataGrid1.columns [1] .ItemStyle.width = unit_bind ();} public void data_bind () {response.cachecontrol = "no-cache" ; Response.Expires = -1; try {string strSQL = "SELECT id, objectGuid, Title, CreateDate, HitCount FROM Document ORDER BY id DESC"; string cnString = (new Connection ()) ConnectionString;. OleDbConnection cn = new OleDbConnection ( cnString); cn.Open (); OleDbCommand cmd = new OleDbCommand (strSQL, cn); DataGrid1.DataSource = cmd.ExecuteReader (CommandBehavior.CloseConnection); DataGrid1.DataBind (); cn.Close (); cn.Dispose () CN = NULL; cmd.dispose (); cmd = null;} catch (oledbexception myoledbexception) {response.write ("Error: myoledbexception.Message ": myoledbexception.helplink; response.end (); }} private void datagrid1_itemdatabase (Object Sender System.Web.ui.WebControls.DataGriditeMeventargs e) {if (E.Item.itemindex! = -1) {E.Item.attributes.add ("onmouseover", "this.bgcolor = '# c1d2ee'); E.Item.attributes.add ("onclick", "document.all.text1.innertext = this.cells [0] .innertext; Document.all.form1.city.value = this.cells [0] .innertext;" ); if (E.Item.itemindex% 2 == 0) {E.Item.attributes.add ("BGColor", "#fffffff"); E.Item.attributes.add ("onmouseout", "this.bgcolor = Document.getElementByid ('DataGrid1'). GetAttribute ('SingLevalue') ");} else {E.Item.attributes.add ("