views:

493

answers:

2

Hi,

I have a dropdown list that stores name/value pairs. The dropdown appears in each row of a gridview.

The values in the dropdown correspond to a third attribute (data type) not persisted in the dropdown list. I'd like to create a client-side "lookup" table so that when a user chooses a dropdown value, the proper data type populates next to it.

What's the best way to accomplish this in an ASP.NET application? The List of value/attributes could potentially range from 1 to 100 members in a list...

A: 

If you want it all to run client side, then your only option is probably JavaScript.

var oVals = new Array('1','2','3','4','5');

document.getElementById("cell1").innerHTML = oVals[document.getElementById("dropdown1").selectedIndex];
Ady
+1  A: 

Found a nice solution at snipplr.com (http://tinyurl.com/67rzav)

The function call looks something like this:

var profileHeaders = new AArray(); 

profileHeaders .add("k01", "hi");
profileHeaders .add("k02", "ho");

var oC = profileHeaders .get("k02");

alert(oC);
Caveatrob