CSS样式停在局​​部回传工作 [英] Css style stops working on partial postback

查看:107
本文介绍了CSS样式停在局​​部回传工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP.net C#应用程序

in a ASP.net C# application

我有一个自定义的CSS的复选框。

I have a Checkbox with a custom css.

CSS文件是:

<link href="css/default.css" rel="stylesheet" type="text/css" />

复选框

<input id="boxcheck" runat="server" type="checkbox" checked="checked" class="customCheckbox" onclick="ChangeSett();"/>

一切正常。

但是,当我把它更新面板内。当我做了局部回传的样式都将丢失。

But when I put it inside an update panel. The style is lost when I do a partial postback.

感谢您的帮助。

推荐答案

我有类似的问题。结果
 我解决了其移动CSS &LT;链接.. &LT;网页&GT; &LT;头方式&gt;

I had similar problem.
I solved it moving css <link .. from the <page> to the <header>.

由于我使用一个母版,我不希望在所有页面的链接,我发现投入的母版的标题

Since I use a MasterPage and I don't want the link in all pages, I found useful putting a ContentPlaceHolder in the MasterPage's Header

<head id="Head1" runat="server">
  ...
  <asp:ContentPlaceHolder ID="HeaderContentPlaceHolder" runat="server"/>
</head>

然后将所需的页面内的链接:

and then the link inside the desired page:

<asp:Content ID="Content2" ContentPlaceHolderID="HeaderContentPlaceHolder"       Runat="Server">
    <link rel="stylesheet" type="text/css" href="CSS/my.css" />
</asp:Content> 

这篇关于CSS样式停在局​​部回传工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆