锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
Support generate file/project files and batch generate, and you can save you selection to a named working set in batch generate mode.
Using Javascript as the template engine 闃呰鍏ㄦ枃
]]>
Show how to add script to the client in aspx file.
/// <param name="rbl">RadioButtonList to apply script to</param> /// <param name="page">The Page the script is going to be appended to</param> /// <param name="script">The script to append</param> public static void SetRadioButtonListItemScript(RadioButtonList rbl, Page page, string script)
{
for (int idx = 0; idx < rbl.Items.Count; idx++)
{
RegisterClientObjectFunction(page, rbl, idx, script);
}
}
/// <param name="page">The Page the script is going to be appended to</param> /// <param name="rbl">RadioButtonList to apply script to</param> /// <param name="idx">the index of the radio button</param> /// <param name="script">The script to append</param> static private void RegisterClientObjectFunction(Page page, RadioButtonList rbl, int idx, string script)
{
StringBuilder sw = new StringBuilder();
if (!page.IsStartupScriptRegistered(rbl.ClientID + "_" + idx.ToString() + "script"))
{
sw.Append(@"<SCRIPT>");
sw.Append(@"document.getElementById('" + rbl.ClientID + "_" + idx.ToString() + "').onclick=function() {" + script + "return true;}");
sw.Append(@"</SCRIPT>");
page.RegisterStartupScript(rbl.ClientID + "_" + idx.ToString() + "script", sw.ToString());
}
}
static private void RegisterClientObjectFunction(Page page, CheckBox chk, string script)
{
StringBuilder sw = new StringBuilder();
if (!page.IsStartupScriptRegistered(chk + "script"))
{
sw.Append(@"<SCRIPT>");
sw.Append(@"document.getElementById('"+chk.ClientID + "').onclick=function() {" + script + "return true;}");
sw.Append(@"</SCRIPT>");
page.RegisterStartupScript(chk.ClientID + "script", sw.ToString());
}
}
document.getElementById("ctrl_id").readOnly = true; //pay attention to the readOnly, it's case sensitive.
Set option to unable to select for select control:
<option value="Genre" disabled="disabled">Genre</option>
Set select control to disabled (it has no readonly property):
<select disabled="disabled"></select>
Add a new option to a select control, it works under firefox 2.x and IE 5.x:
function addOption(select_ctrl, option_value, option_text){
var ctrl = document.getElementById(selectctl);
if(ctrl == null)
return;
var doc = ctrl.ownerDocument;
if (!doc)
doc = ctrl.document;
var opt = doc.createElement('OPTION');
opt.value = option_value;
opt.text = option_text;
ctrl.options.add(opt, ctrl.options.length);
}
Delete an option from select control:
selectctl.options[selectctl.selectedIndex] = null;
Delete all options from select control:
selectctrl.options.length = 0;
Change the css for an object:
document.getElementById("ctrl_id").className="SHOWN";