Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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'.

XML
<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>



C#
Lbldetails.Style[HtmlTextWriterStyle.Top] = "610px";
                Lbldetails.Visible = true;
Posted
Comments
Ganesh Rana <> 12-Mar-14 8:25am    
check bellow link

http://stackoverflow.com/questions/13028443/how-to-align-asp-net-label-text-in-center?rq=1

use this ...may b this will help u
XML
<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>
 
Share this answer
 
Comments
S.Rajendran from Coimbatore 12-Mar-14 10:53am    
not working
MAYANK GEETE 13-Mar-14 0:49am    
set height of table to 500px ...like
<table width="100%" style="height:500px">
ASP.NET
<form  runat="server">
<asp:panel id="pan1" runat="server" horizontalalign="centre">
Hello!
</asp:panel>
</form>
 
Share this answer
 
v2
Comments
Ankur\m/ 12-Mar-14 8:42am    
Please update your code formatting. If you are posting it from VS, select the option 'Code Block' after you paste it.
S.Rajendran from Coimbatore 12-Mar-14 10:52am    
not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900