开发者

How can I place two controls in the same place and alternate between them?

I want to place two datalist controls at the same (x,y) position. When the first is visible, second should be开发者_如何学运维 invisible.

How would I go about implementing this?


You can toggle visibility of 2 divs. You then put your controls inside the separate divs and manipualte display: block or diplay:none based on whether you want to hide or show one control or another. This can be easily done with jQuery.


It doesn't matter which control you use, it only matters how you style the resulting page. You can achieve this with absolute positioning in your styling, effectively giving both elements the same X,Y coordinates (but different Z positions, ideally) relative either to the window, the page, a parent element, etc. However, this can sometimes complicate things in your layout.

However, if only one of the two elements is going to be visible at any given time, then I recommend just placing them on the page as you normally would, just one after the other. For the one that's not visible, either set is as .Visible=false on the server-side so that it isn't sent to the client at all, or set its style as display: none; on the client-side to not render it. That way both elements are available and just shown/hidden as needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜