Solved

Align the buttons to the same position

Posted on 2014-01-17
12
235 Views
Last Modified: 2014-02-06
Hi,
I want to align both buttons to be on the same position. how?
t643.png
0
Comment
Question by:HuaMinChen
  • 6
  • 4
12 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
Set the left position to the same value.
btn2.Left = btn1.Left;
0
 
LVL 10

Author Comment

by:HuaMinChen
Comment Utility
In code-behind, I cannot choose this

btn1.Left

Open in new window

0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
Before
And the code  in C# of the click on button1
        private void button1_Click(object sender, EventArgs e)
        {
            button2.Left = button1.Left;
        }

After
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
ps.  You need to replace btn1 and btn2 (button1 and button2) with the real names of the buttons in your code.
0
 
LVL 10

Author Comment

by:HuaMinChen
Comment Utility
Sorry, in VS 2013, I get these
Error      3      'System.Web.UI.WebControls.Button' does not contain a definition for 'Left' and no extension method 'Left' accepting a first argument of type 'System.Web.UI.WebControls.Button' could be found (are you missing a using directive or an assembly reference?)      C:\App12\App12\Default.aspx.cs      443      23      App12
Error      4      'System.Web.UI.WebControls.Button' does not contain a definition for 'Left' and no extension method 'Left' accepting a first argument of type 'System.Web.UI.WebControls.Button' could be found (are you missing a using directive or an assembly reference?)      C:\App12\App12\Default.aspx.cs      443      43      App12

due to this line

bt_ite.Left = bt_obj.Left;

Open in new window

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 44

Accepted Solution

by:
AndyAinscow earned 145 total points
Comment Utility
>>WebControls.Button

(Aha, you hadn't specified that sort of button.  With a button on a form the Left and Top properties do exist.)

I don't think you can change the position, only the width and height.  (Or have it in a table cell - there you can cheat because it is inside the cell which will be vertically aligned with the cell above).
0
 
LVL 10

Author Comment

by:HuaMinChen
Comment Utility
I've requested that this question be deleted for the following reason:

The program does need the help regarding ASP page but the answers are just related to C# forms.
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
As pointed out in my previous comment, it does not seem to be possible with a web button.  No, you can't do that is a valid answer to a question.  (In the help files there are only width and height properties).
Also suggested is a method that would align buttons should it be suitable.
0
 
LVL 10

Author Comment

by:HuaMinChen
Comment Utility
Andy,
The way you were talking about, is only applicable to C# form, but it is not for ASP page at all. This is the point!
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
>>The way you were talking about, is only applicable to C# form, but it is not for ASP page at all.
What I see here is the question area of .net programming with extra topics areas of .NET, C# Programming Language, Components - nothing about ASP or web.

When you later point out it is a WebButton (in the error message) then it is clear why my first suggestion isn't applicable.  That is why I made a further comment about it apparently not being possible to do what you asked for.  (Which is a valid answer, some questions can not be answered by yes as much as one would want them to be).

I'll abide by what a moderator decides.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now