Tuesday, 8 January 2013

bind dropdownlist with javascript using sql database with ahsx

<script type="text/javascript">

        window.onload = GetfilldataReservoir("rdatav");

        function GetfilldataReservoir(rdatav) {
            var selpkg = "rvdataval";
            jQuery.ajax({

                url: 'ReportHandler.ashx',
                type: "GET",
                data: "ssid=" + selpkg,
                success: function(data) {
                    var rvdatastore = data;
                    rvdatastore = rvdatastore.slice(0, rvdatastore.length - 1);
                    var dataspl = rvdatastore.split("~");
                    var dlldata = document.getElementById('<%= selectrvdata.ClientID %>');

                    for (var val = 0; val < dataspl.length; val++) {
                        AddItem(dataspl[val + 1], dataspl[val])
                        val++;
                    }
                }

            })
        }
        function AddItem(Text, Value) {
            var opt = document.createElement("option");
            document.getElementById('<%= selectrvdata.ClientID %>').options.add(opt);
            opt.value = Value;
            opt.text = Text;

        }
    </script>

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...