How To populate dropdownlist from array in javascript How to sort a DataTable before passing on to DataGrid
Oct 06
<%@ Page Language="C#" Debug="true" %>
<script runat="server">

void Page_Load(Object sender, EventArgs e)
{
String scriptString = "\n";
scriptString += "<script language=JavaScript>\n";
scriptString += "<" + "!--\n";
scriptString += "    function showIds() {\n";
scriptString += "        for(var index=0;index < ids.length;index++)\n";
scriptString += "        document.write(ids[index] + '<br>');\n";
scriptString += "    }\n";
scriptString += "//-->\n";
scriptString += "<" + "/" + "script>\n";

RegisterStartupScript("arrayScript", scriptString);

string[] ids = {"111","112","the third one","114"};
RegisterArrayDeclaration("ids","'" + String.Join("','",ids) + "'");

}

Leave a Reply