如何添加一个css类到ASP.Net的更新面板? [英] How can I add a css class to an updatepanel in ASP.Net?

查看:121
本文介绍了如何添加一个css类到ASP.Net的更新面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将css类添加到asp.net下的c#代码后面文件中的updatepanel

How can I add a css class to an updatepanel in the c# code behind file of asp.net

推荐答案

看到更新面板没有css类属性。所以,因为它不能直接完成你需要一个工作;有两个(从 UpdatePanel和CSS )可以得到你想要的行为。

As you've seen the update panel doesn't have a css class property. So since it can't be done directly you need a work around; there are two (Grabbed from UpdatePanel and CSS) that can get the behavior you desire.

一个是用一个div包围更新面板:

One is to surround the update panel with a div:

<div id="foo" style="visibility: hidden; position: absolute">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    </asp:UpdatePanel>
</div>

另一种是根据更新面板的id应用css选择器:

The other is to apply a css selector based on the update panel's id:

<style type="text/css">
#<%=UpdatePanel1.ClientID%> {
    visibility: hidden;
    position: absolute;
}
</style>

文章中没有提到的另一种方式是在一个div中包围面板,在它上呈现为div:

Yet another way not mentioned in the article is surround the panel in a div and style the update panel based on it rendering as a div:

<style type="text/css">
#foo div {
    visibility: hidden;
    position: absolute;
}
</style>

<div id="foo">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    </asp:UpdatePanel>
</div>

这篇关于如何添加一个css类到ASP.Net的更新面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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