Tuesday, January 19, 2010

How to Get the value and text of a Dropdownlist using JavaScript

//Using this function you can get the value and text of dropdownList using JavaScript

function GetDropDornListValueAndText()
{
ddlReport = document.getElementById("<%=DropDownListReports.ClientID%>");
var Text = ddlReport.options[ddlReport.selectedIndex].text;
var Value = ddlReport.options[ddlReport.selectedIndex].value;

}

No comments:

Post a Comment