本文介绍了如何在窗体的中心显示Label控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个数据列表,其中包含多个带有相应按钮的图像。单击任何按钮,我希望标签显示在窗体的中心而不滚动。在下面的代码中,我必须滚动以读取该位置的标签。如何使这个标签控制'Lbldetails'在点击任何按钮控件'BtnDetails'时在窗体的中心发出咔嗒声。 < asp:UpdatePanel ID = dd runat = server > < ContentTemplate > < asp:按钮 ID = AddToCart runat = server 文字 =' 添加到购物车 BackColor = DarkSlateBlue 宽度 = 100px 样式 = font-family:Arial ForeColor = 白色 commandname = myevent > < / asp:按钮 > < asp:按钮 ID = BtnDetails runat = server 文字 =' 详细信息' BackColor = DarkSlateBlue 宽度 = 100px 样式 = font-family:Arial ForeColor = 白色 commandname = myeventDetails > < / asp:按钮 > < asp:标签 ID = Lbldetails runat = server 可见 = false 高度 = 197 BackColor = 黑色 ForeColor = GhostWhite 样式 = size:auto;溢出:汽车;宽度:246px > < / asp:标签 > Lbldetails.Style [HtmlTextWriterStyle.Top] = 610px; Lbldetails.Visible = true ; 解决方案 使用此...可能这将有助于你 < table width = 100% > < tr > < ; td align = 中心 > < asp:标签 ID = Lbldetails runat = 服务器 可见 = false 高度 = 197 BackColor = 黑色 ForeColor = GhostWhite 样式 = 大小:自动;溢出:汽车;宽度:246px > < / asp:标签 > < / td > < / tr > < / table > < 表格 runat = server > < asp:panel id = pan1 runat = server horizo​​ntalalign = center > 您好! < / asp:panel > < / form > I have a datalist with several images with respective buttons. On click of any button I want the label to be shown at the cente of the form without scrolling. In the following code I have to scroll to read the label at that position. How to make this label control 'Lbldetails' to make visble at the center of the form on click of any button control 'BtnDetails'.<asp:UpdatePanel ID="dd" runat="server" > <ContentTemplate> <asp:Button ID="AddToCart" runat = "server" Text='Add to Cart' BackColor="DarkSlateBlue" Width="100px" Style=" font-family:Arial" ForeColor="White" commandname="myevent"> </asp:Button> <asp:Button ID="BtnDetails" runat = "server" Text='Details' BackColor="DarkSlateBlue" Width="100px" Style=" font-family:Arial" ForeColor="White" commandname="myeventDetails"> </asp:Button> <asp:Label ID="Lbldetails" runat="server" Visible="false" Height="197" BackColor="Black" ForeColor="GhostWhite" style=" size:auto; overflow:auto; width:246px"> </asp:Label>Lbldetails.Style[HtmlTextWriterStyle.Top] = "610px"; Lbldetails.Visible = true; 解决方案 use this ...may b this will help u<table width="100%"> <tr> <td align="Center"> <asp:Label ID="Lbldetails" runat="server" Visible="false" Height="197" BackColor="Black" ForeColor="GhostWhite" style=" size:auto; overflow:auto; width:246px"> </asp:Label> </td> </tr></table><form runat="server"><asp:panel id="pan1" runat="server" horizontalalign="centre">Hello!</asp:panel></form> 这篇关于如何在窗体的中心显示Label控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-22 23:02