Available DROPDOWNLIST + server data

xiaoxiao2021-03-06  37

When the desktop program is changed to a web program, an Infragistics control used in the original program can be entered and down, the drop-down is displayed as a table, although INFRAGistics also provides such web control, but during use Some bugs have appeared. The setting is also cumbersome. So I have to write it yourself.

However, there is no way to write a control, and the versatility is relatively poor.

1. In the server side, the optional value will be guided in a DataGrid, set this DataGrid's Display = 'None'

2. Set the onlick value of each item of DataGrid again on the server side.

For i = 0 to dgd.Items.count - 1

DGD.Items (i) .attributes.add ("onclick", "show (" " DGD.Items (i) .cells (0) .Text.trim " "" " txt.clientid " ') ")

DGD.Items (i) .attributes.add ("onmouseover", "this.classname = 'SEL';")

DGD.Items (i) .attributes.add ("onmouseout", "this.classname = 'params';")

DGD.Items (i) .cssclass = "params"

NEXT

Here must be set in the client in the reality what value when clicking on a row

3. Also on the server side set the client event of a click picture

Img.attributes.add ("onclick", "Lstparams ('" txt.clientid ",'" dgd.clientid ")")

Show which TEXTBOX in which DataGrid is

4. Repair the value in the hidden DataGrid to be displayed in the client JavaScript to a DIV and set the location displayed

/

Style = "Display: None; z-index: 102; Left: 288px; width: 200px; position: absolute; top: 264px; height: 115px" /> /

Function Lstparams (TxtBox, DGD) {var x, y; var DD = document.all ['DivParams']; var dpar = document.all [DGD]; var E = Document.All [TXTBOX]; var; var; var; var; var; = E.OffSettop E.OffsetHeight; var x = E.Offsetleft; while (e = E.OffsetParent) {y = E.OffSettop; x = E.Offsetleft;}

Str = dpar.innerhtml;

Dd.innerhtml = "/

" STR "/ ";

With (DD.Style) {Left = x; TOP = Y;}} Client Click on the event:

Function show (value, ctr) {document.all [ctr] .value = value;

Function hideparams () {var = window.event.srcelement; if (El.Id.indexof ('btnlst') == - 1) Document.all ['DivParams']. style.display = 'none'; else { IF (Document.all ['Divparams']. style.display ==' none ') Document.all [' DivParams']. style.display = '; else document.all [' DivParams']. style.display = 'none';}}

Window.Document.attachevent ("OnClick", HIDEPARAMS;

5. To imitate the picture like DropDownList to set click Next to TextBox

IMG ID = btnlst style = "z-index: 1; top: 4px; left: -5px; position: relative" alt = "src =" images / btn.gif "runat = server

This way, you can simulate a input-entered DropDownList to a table, and a line in the point can display the value to be displayed in the input box.

转载请注明原文地址:https://www.9cbs.com/read-66931.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.037, SQL: 9