一个页面多次调用自定义控件时,注册JS脚本 string strBlock = @" <script type='text/javascript'>
function " + MethodName + " {document.getElementById('" + m_hitDateInput.ClientID + "').readOnly=true;document.getElementById('" + m_hitDateInput.ClientID + "').value='" + m_hitDateInput.Text + "';}</script>";
m_hitDateInput.Attributes["onmousedown"] = MethodName;
m_hitDateInput.Attributes["onchange"] = MethodName; ;
writer.Write(strBlock);
Type type = typeof(FWDateTime);
if (!Page.ClientScript.IsClientScriptBlockRegistered(type, type.FullName))
{
Page.ClientScript.RegisterClientScriptBlock(type, type.FullName, strBlock);
}