To set the div position(used for DataGrid Imeplate Column with DropDownList item)
1var TextTemp;
2var ValueTemp;
3var ddlTemp;
4function ShowDropDownList(FillText,FillValue,ddl,ddldiv,parentdiv)
5{
6
7 var ctlFillText = document.getElementById(FillText);
8 var ctlFillValue = document.getElementById(FillText.replace(FillText.substring(FillText.lastIndexOf("_")+1,FillText.length),FillValue));
9 var ctldiv = document.getElementById(ddldiv);
10 var ctlddl = document.getElementById(ddl);
11 var ctlparentdiv = document.getElementById(parentdiv);
12
13 if(typeof(ddlTemp)=='undefined')
14 {
15 ctlddl.style.display="inline";
16 }
17 else
18 {
19 var id = TextTemp.id;
20 if(id.substring(id.lastIndexOf('_'),id.length)!=FillText.substring(FillText.lastIndexOf('_'),id.length))
21 {
22 ddlTemp.style.display = "none";
23 ctlddl.style.display = "inline";
24 }
25 }
26
27 TextTemp = ctlFillText;
28 ValueTemp = ctlFillValue;
29 ddlTemp = ctlddl;
30
31 SetPosition(ctldiv,ctlparentdiv);
32 SetSelected(ctlddl,ctlFillValue)
33}
34
35function SetSelected(ctlddl,ctlFillValue)
36{
37 var options = ctlddl.options;
38 var index=0;
39 for(var i = 0;i<options.length;i++)
40 {
41 if(options[i].value==ctlFillValue.value)
42 {
43 index=i;
44 break;
45 }
46 }
47 ctlddl.options[index].selected = true;
48}
49function SetPosition(ctldiv,ctlparentdiv)
50{
51 try
52 {
53 ctldiv.style.top = TextTemp.parentElement.offsetTop-ctlparentdiv.scrollTop+"px";
54 ctldiv.style.left = TextTemp.parentElement.offsetLeft+"px";
55 ctldiv.style.height = TextTemp.parentElement.offsetHeight+"px";
56 ctldiv.style.width = TextTemp.parentElement.offsetWidth+"px";
57 }
58 catch(e)
59 {
60 //when you have not selected the cell to scroll the scroller, will ocuer a error that says 'The parentElement is not a object and other informations'
61 }
62}
63
64function change(ddlID,index)
65{
66 var sel = document.getElementById(ddlID);
67
68 TextTemp.value = sel.options[index].text;
69 ValueTemp.value = sel.options[index].value;
70}
2var ValueTemp;
3var ddlTemp;
4function ShowDropDownList(FillText,FillValue,ddl,ddldiv,parentdiv)
5{
6
7 var ctlFillText = document.getElementById(FillText);
8 var ctlFillValue = document.getElementById(FillText.replace(FillText.substring(FillText.lastIndexOf("_")+1,FillText.length),FillValue));
9 var ctldiv = document.getElementById(ddldiv);
10 var ctlddl = document.getElementById(ddl);
11 var ctlparentdiv = document.getElementById(parentdiv);
12
13 if(typeof(ddlTemp)=='undefined')
14 {
15 ctlddl.style.display="inline";
16 }
17 else
18 {
19 var id = TextTemp.id;
20 if(id.substring(id.lastIndexOf('_'),id.length)!=FillText.substring(FillText.lastIndexOf('_'),id.length))
21 {
22 ddlTemp.style.display = "none";
23 ctlddl.style.display = "inline";
24 }
25 }
26
27 TextTemp = ctlFillText;
28 ValueTemp = ctlFillValue;
29 ddlTemp = ctlddl;
30
31 SetPosition(ctldiv,ctlparentdiv);
32 SetSelected(ctlddl,ctlFillValue)
33}
34
35function SetSelected(ctlddl,ctlFillValue)
36{
37 var options = ctlddl.options;
38 var index=0;
39 for(var i = 0;i<options.length;i++)
40 {
41 if(options[i].value==ctlFillValue.value)
42 {
43 index=i;
44 break;
45 }
46 }
47 ctlddl.options[index].selected = true;
48}
49function SetPosition(ctldiv,ctlparentdiv)
50{
51 try
52 {
53 ctldiv.style.top = TextTemp.parentElement.offsetTop-ctlparentdiv.scrollTop+"px";
54 ctldiv.style.left = TextTemp.parentElement.offsetLeft+"px";
55 ctldiv.style.height = TextTemp.parentElement.offsetHeight+"px";
56 ctldiv.style.width = TextTemp.parentElement.offsetWidth+"px";
57 }
58 catch(e)
59 {
60 //when you have not selected the cell to scroll the scroller, will ocuer a error that says 'The parentElement is not a object and other informations'
61 }
62}
63
64function change(ddlID,index)
65{
66 var sel = document.getElementById(ddlID);
67
68 TextTemp.value = sel.options[index].text;
69 ValueTemp.value = sel.options[index].value;
70}