Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used asp:button for button and asp:label for label. i want to align them in a same line button is at left side and label at right side. button has its click event and label shows current date.i want both should be in a same line.how do i do ? please tell me answer

What I have tried:





<asp:Button ID="BtnBack" runat="server" Text="Back To List" PostBackUrl="~/frmEarning.aspx" CssClass="btn btn-default " />






<asp:Label runat="server">Current Date:
<asp:Label runat="server" ID="lbldate">



Posted
Updated 31-Mar-16 7:58am
Comments
parthgoswami 31-Mar-16 13:58pm    
<div>
<table>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="Button" />
</td>
<td>
<asp:Label ID="Label1" runat="server" Text="Label">
</td>
</tr>
</table>
</div>

Use below table designing structure to develop page and give width, align to your cell.

<table>
  <tr>
    <td>Button</td>
    <td>Lable</td>
  </tr>
</table>


Thanks
 
Share this answer
 
Comments
Member 12423456 31-Mar-16 9:29am    
i am to make my website responsive that's why i use div sections for all the controls i didn't use table anywhere in my page and i don't want to use table because it may affect my website for making it responsive. please tell me some other solution
Sagar Haridas Shinde 1-Apr-16 8:42am    
Use div coding structure with floating property for ex -
<div style="float:Left;">Button</div>
<div style="float:Left;">Label</div>
<div style="clear:both;">Label</div>
Place the controls in a div

ASP.NET
<div>
   <asp:button id="button1" text="Button" runat="server" onclick="button1_Click" xmlns:asp="#unknown" />
      <asp:label id="label1" text="Label" runat="server" xmlns:asp="#unknown" />
  </div>


Code behind: on the click event assign the date to the label control's Text Property.

C#
protected void button1_Click(object sender, EventArgs e)
       {
           label1.Text = DateTime.Now.ToString();
       }
 
Share this answer
 
Comments
Member 12423456 31-Mar-16 9:32am    
Thank you for your respond.i tried your solutions but it is not that what i want. please tell me any other solution
Karthik_Mahalingam 31-Mar-16 10:28am    
did you try float:left
 
Share this answer
 

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