如果使用更新面板,则无法完全占据单元格空间区域 [英] Not fully occupying cell space area if update panel used

查看:72
本文介绍了如果使用更新面板,则无法完全占据单元格空间区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net中有一个用户控件,该控件在一个表中有两个文本滚动器.两个滚动条都有自己的触发器.代码如下:

I have a user control in asp.net, which is having two text scrollers within a table. Both scrollers having their own triggers. The code is given as below:

 <asp:Timer runat="server" id="UpdateTimer1" interval="60000" ontick="UpdateTimer1_Tick" />
 <asp:Timer runat="server" id="UpdateTimer2" interval="60000" ontick="UpdateTimer2_Tick" />
<asp:Table ID="Table1" runat="server" Width="100%" Height="100%" GridLines="Both"

CellPadding="2" CellSpacing="2" >
   <asp:TableRow ID="TableRow1" Width="100%" Height="100%">
     <asp:TableCell ID="cellScroller1" runat="server" Width="50%" Height="100%">
        <asp:UpdatePanel runat="server" id="UpdatePanel1" updatemode="Conditional">
            <triggers>
                <asp:AsyncPostBackTrigger controlid="UpdateTimer1" eventname="Tick" />
            </triggers>
            <contenttemplate>
                <marquee onmouseover="stop();" onmouseout="start();" scrollAmount="1" scrollDelay="30" direction="up">
                    <asp:Label ID="lblTextScroller1" Runat="server" Width="100%" Height="100%" BorderWidth="1px">scoller1 text
               </marquee>
            </contenttemplate>
        
     
     <asp:TableCell ID="cellScroller2" runat="server" Width="50%" Height="100%" BorderWidth="2px">             
         <asp:UpdatePanel runat="server" id="UpdatePanel2" updatemode="Conditional">
            <triggers>
                <asp:AsyncPostBackTrigger controlid="UpdateTimer2" eventname="Tick" />
            </triggers>
            <contenttemplate>
                <marquee onmouseover="stop();" onmouseout="start();" scrollAmount="1" scrollDelay="30" direction="up">
                    <asp:Label ID="lblTextScroller2" Runat="server" Width="100%" Height="100%" BorderWidth="1px">scoller2 text
               </marquee>
            </contenttemplate>





protected void UpdateTimer1_Tick(object sender, EventArgs e)
{
    //TODO
}
protected void UpdateTimer2_Tick(object sender, EventArgs e)
{
    //TODO
}


为什么两个文本收集器都没有完全占据它们的单元格空间区域?


Why both the text scollers are not fully occupying their cell space area?

推荐答案

我找到了解决方案!

用户控制代码:
I found the solution!

User Control Code:
<asp:timer runat="server" id="UpdateTimer1" interval="60000" ontick="UpdateTimer1_Tick" xmlns:asp="#unknown" />
 <asp:timer runat="server" id="UpdateTimer2" interval="60000" ontick="UpdateTimer2_Tick" xmlns:asp="#unknown" />
<asp:table id="Table1" runat="server" width="100%" height="100%" gridlines="Both" xmlns:asp="#unknown">
CellPadding="2" CellSpacing="2" >
   <asp:tablerow id="TableRow1" width="100%" height="100%">
     <asp:tablecell id="cellScroller1" runat="server" width="50%" height="100%">
        <asp:updatepanel runat="server" id="UpdatePanel1" updatemode="Conditional">
            <triggers>
                <asp:asyncpostbacktrigger controlid="UpdateTimer1" eventname="Tick" />
            </triggers>
            <contenttemplate>
                <marquee onmouseover="stop();" onmouseout="start();" scrollAmount="1" scrollDelay="30" direction="up">
                    <asp:label id="lblTextScroller1" runat="server" width="100%" height="100%" borderwidth="1px">scoller1 text</asp:label>
               </marquee>
            </contenttemplate>
        </asp:updatepanel>
     </asp:tablecell>
     <asp:tablecell id="cellScroller2" runat="server" width="50%" height="100%" borderwidth="2px">             
         <asp:updatepanel runat="server" id="UpdatePanel2" updatemode="Conditional">
            <triggers>
                <asp:asyncpostbacktrigger controlid="UpdateTimer2" eventname="Tick" />
            </triggers>
            <contenttemplate>
                <marquee onmouseover="stop();" onmouseout="start();" scrollAmount="1" scrollDelay="30" direction="up">
                    <asp:label id="lblTextScroller2" runat="server" width="100%" height="100%" borderwidth="1px">scoller2 text</asp:label>
               </marquee>
            </contenttemplate>
        </asp:updatepanel>
    </asp:tablecell>
   </asp:tablerow>          
</asp:table>



在Default.aspx中:



In Default.aspx:

<form id="form1" runat="server">
    <asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown" />
        <div>        
            <asp:table id="Table2" runat="server" width="100%" height="100%" gridlines="Both" xmlns:asp="#unknown">
                    CellPadding="2" CellSpacing="2" >
                <asp:tablerow id="TableRow2" width="100%" height="100%">
                    <asp:tablecell id="TableCell1" runat="server" width="50%" height="100%">
                        <uc:webusercontrol1 id="webUserControl1" runat="server" xmlns:uc="#unknown" /> 
                    </asp:tablecell>
                </asp:tablerow>          
            </asp:table>
        </div>          
    </form></form>



谢谢! :)



Thanks! :)


这篇关于如果使用更新面板,则无法完全占据单元格空间区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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