为什么我的 CalendarExtender 在渲染时会重叠?

发布于 2024-07-09 07:09:07 字数 291 浏览 7 评论 0原文

我正在开发一个 .NET Web 应用程序,并在其中使用 CalendarExtender 控件让用户指定日期。 由于某种原因,当我单击图标显示日历时,背景似乎是透明的。

我在其他页面上使用扩展器,没有遇到这个问题。

我不确定是否值得一提,但日历嵌套在一个带有圆角扩展器的面板内,以及它下面的面板(其中“来自”重叠)。

在该面板中,我确实有一个 div 布局设置来创建两列。

编辑:这里要注意的另一件事是,具有名称和昵称“占位符”的部分都是 ASP.NET 标签控件(如果这很重要)。

I'm working on a .NET web application and I'm using a CalendarExtender control within it to have the user specify a date. For some reason, when I click the icon to display the calendar, the background seems to be transparent.

I'm using the extender on other pages and do not run into this issue.

I'm not sure if it is worth mentioning, but the calendar is nested within a panel that has a rounded corner extender attached to it, as well as the panel below it (where the "From" is overlapping).

Within that panel, I do have a div layout setup to create two columns.

EDIT: The other thing to note here is that the section that has the name and "placeholders" for nickname are all ASP.NET label controls, if that matters.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

纵山崖 2024-07-16 07:09:08

所以再多研究一下,我就解决了这个问题。 部分问题是由于我设置的用于创建两个单独列的 div 布局使用了position:relative 和 float:right/left 属性。

据我所知,一旦开始增加 div 标签的位置属性,它就会影响渲染的 z-index,只有当日历控件动态“弹出”时,这才会变得复杂。

不幸的是,CalendarExtender 没有 Z-Index 属性,除非您想为日历编写整个样式,但我不想这样做。 但是,您可以通过将以下内容添加到 CSS 文件来扩展默认样式:

.ajax__calendar_container { z-index : 1000 ; }

如果您没有使用 CSS 文件,您还可以将其添加到页面的 head 部分:

<style type="text/css">
   .ajax__calendar_container { z-index : 1000 ; }
</style>

这样就可以解决问题。 这对我有用。

如果由于某种原因这不起作用(并且有些人仍然报告问题),更“激进”的方法是将输入字段和 CalendarExtender 包装在 DIV 标记中,然后将以下内容添加到 CSS 文件/HEAD 部分:

.ajax__calendar {
    position: relative;
    left: 0px !important;
    top: 0px !important;
    visibility: visible; display: block;
}
.ajax__calendar iframe
{
    left: 0px !important;
    top: 0px !important;
}

...希望这对您有用。

So some more poking around and I figured out the issue. Part of the problem arises from the fact that the div layout I setup to create two separate columns is using the position:relative and float:right/left attributes.

From what I've read, as soon as you start augmenting the position attribute of a div tag, it affects the z-index of the rendering, which only gets complicated when the calendar control is "popping up" dynamically.

Unfortunately there is no Z-Index attribute to the CalendarExtender, unless you want to write an entire style for the calendar, which I don't want to do. However, you can extend the default style by adding the following to your CSS file:

.ajax__calendar_container { z-index : 1000 ; }

If you aren't using a CSS file, you can also add this into the head section of your page:

<style type="text/css">
   .ajax__calendar_container { z-index : 1000 ; }
</style>

and that should do the trick. It worked for me.

If for some reason this doesn't work (and some people were still reporting problems), a little more "aggressive" approach was to wrap the input fields and CalendarExtender in a DIV tag and then add the following to your CSS file / HEAD section:

.ajax__calendar {
    position: relative;
    left: 0px !important;
    top: 0px !important;
    visibility: visible; display: block;
}
.ajax__calendar iframe
{
    left: 0px !important;
    top: 0px !important;
}

...and hopefully that will work for you.

去了角落 2024-07-16 07:09:08

我发现解决 IE7 中问题的唯一方法是向我遇到问题的页面添加一些额外的 CSS。 再多的 z 索引或 div 包装和重新设计也没有效果。

以下更改控件堆叠上下文。

.ajax__calendar_container
{
    position:static;
}

这确实会导致日历弹出窗口垂直出现在扩展器控件上方,而不是像平常一样垂直出现在下方。 对我来说这是可以接受的。

The only way i have found to resolve the issue in IE7 was to add some extra CSS to the page i was having problems with. No amount of z-indexing or div wrapping and re-styling was having an effect.

The following changes the controls stacking context.

.ajax__calendar_container
{
    position:static;
}

This does result in the calendar popup appearing vertically above the extender control instead of vertically below as normal. For me that was acceptable.

国粹 2024-07-16 07:09:08

这对我来说看起来并不透明,看起来它是在其他元素“后面”渲染的。
您是否为任何项目指定了“z-index”?

That doesn't look transparent to me, it looks like it's rendering "behind" the other elements.
Do you have a "z-index" specified for any items?

一袭白衣梦中忆 2024-07-16 07:09:08

我有一个类似的问题,我用字段集上的 z 索引修复了

如果你有,

<fieldset> some content... including ajax popup </fieldset>
<fieldset> some more content </fieldset>

那么 ajax 弹出窗口会在第二个字段集下方弹出,以修复将第一个字段集上的 z 索引设置为高于第二个字段集上的 z 索引,即以下。

<fieldset style="z-index: 2;"> some content... including ajax popup </fieldset>
<fieldset style="z-index: 1;"> some more content </fieldset> 

I had a similar issue which I fixed with z index on fieldsets

If you have

<fieldset> some content... including ajax popup </fieldset>
<fieldset> some more content </fieldset>

then the ajax popup pops up underneath the second fieldset, to fix set the z-index on the first fieldset to be higher than the one on the second, ie as below.

<fieldset style="z-index: 2;"> some content... including ajax popup </fieldset>
<fieldset style="z-index: 1;"> some more content </fieldset> 
橘味果▽酱 2024-07-16 07:09:08

我发现解决这个问题的唯一方法是为 calendarExtender 编写一些 css 规则。 这对我有用。 代码如下:

https://gist.github.com/carlosmr12/5825371

The only way I found to solve this problem was to write some css rules for the calendarExtender. It worked for me. The code is below:

https://gist.github.com/carlosmr12/5825371

小傻瓜 2024-07-16 07:09:08

如果这些答案不能正常工作,则可能是隐藏溢出的问题。 可以使用以下 css 来解决这个问题:

.ajax__scroll_none {
    overflow: visible !important;
    z-index: 10000 !important;
}

If those answers does not work properly it might be a problem with hiding overflow. This can be solved using following css:

.ajax__scroll_none {
    overflow: visible !important;
    z-index: 10000 !important;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文