更新时间:2023-02-22 11:07:06
提到这个问题这里.
我尝试了这个建议 - 在 OnInit 中注册 css 链接 - 它似乎有效.
I tried the suggestion - registering the css link in the OnInit - and it seems to work.
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ScriptManager sm = ScriptManager.GetCurrent(Page);
if (!sm.IsInAsyncPostBack)
{
string css = string.Format("<link rel="stylesheet" href="{0}" type="text/css" />", ResolveUrl(CssClassFile));
ScriptManager.RegisterClientScriptBlock(this, typeof(MyBlahControl), "MyBlahId", css, false);
}
}