Oct 06
<html>
<head>
<script>
var aMember = [
["one", "1", "company 1"],
["one", "11", "company 11"],
["one", "111", "company 111"],
["two", "2", "company 2"],
["two", "22", "company 22"],
["three", "3", "company 3"],
["three", "33", "company 33"]];

function selCompany(theSel){
  theForm = theSel.form;
  opt = theForm.companies.options;
  opt.length = 0;
  if(theSel.value=="") return;
  for(i=0;i<aMember.length;i++){
    if(aMember[i][0]==theSel.value){
      tValue = aMember[i][1];
      tName = aMember[i][2];
      for(j=0;j<opt.length;j++){
        if(opt[j].value==tValue) tValue="";
      }
      if(tValue>""){
        opt[opt.length] = new Option(tName, tValue);
      }
    }
  }
}
</script>
</head>
<body>
<form>
Select company
<select name="sel" onchange="selCompany(this);" >
<option value="">-Please select-</option>
<option value="one"> one </option>
<option value="two"> two </option>
<option value="three"> three </option>
</select>
&nbsp;&nbsp;&nbsp;
Companies:
<select name="companies">
</select>
</form>
</body>
</html>
Oct 06

Certain characters in your data will cause Javascript to crash. Special characters need to be handled with your server-side code. Below is a C# function that I create to do just such task.

<br />.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: Consolas, “Courier New”, Courier, Monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br /><br />.csharpcode pre { margin: 0em; }<br /><br />.csharpcode .rem { color: #008000; }<br /><br />.csharpcode .kwrd { color: #0000ff; }<br /><br />.csharpcode .str { color: #006080; }<br /><br />.csharpcode .op { color: #0000c0; }<br /><br />.csharpcode .preproc { color: #cc6633; }<br /><br />.csharpcode .asp { background-color: #ffff00; }<br /><br />.csharpcode .html { color: #800000; }<br /><br />.csharpcode .attr { color: #ff0000; }<br /><br />.csharpcode .alt<br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br /><br />.csharpcode .lnum { color: #606060; }<br />

protected string FormatForJS(object input) {
  string data = input.ToString();
  // cast the input to a string 
  data = data.Trim();
  // replace those characters that will crash JAVASCRIPT 
  data = data.Replace("'", "\\'");
  data = data.Replace("\n", "");
  data = data.Replace("\r", "");
  return data;
}
Oct 06

function setActiveTab(tabNumber)
{
var ctrl = $find(’<%=TabContainer.ClientID%>’);
ctrl.set_activeTab(ctrl.get_tabs()[tabNumber]);
}

this is a function that sets the active tab using javascript so you just set the anchor’s href to look like this:
<a href=’setActiveTab(1)’>Go to Next Tab;