?
Solved

Help with user control; textbox and image

Posted on 2014-10-09
7
Medium Priority
?
177 Views
Last Modified: 2014-10-14
I have  a user control.  it consists of a  textbox and image button.  I would like the image to always to be "stuck" to the right hand side of the textbox.  However, depending on the layout of a page which also changes dynamically based on user entry, sometimes the  image button is moved to underneath the textbox, aligned at the left.   How can I prevent this?  I've tried encapsulating in a div, and also tried a table, putting the textbox and image button in a cell.    Neither worked.

Thanks
0
Comment
Question by:HLRosenberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 22

Expert Comment

by:Mrunal
ID: 40370752
have you tried below css property:

float: right;

for image
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 40370783
Well, that did keep it to the right of the textbox, but it still moved down.  See images.  

Also, here is the source:


<div id="divCalendarPopup" style="position:absolute; visibility:hidden; background-color:white;">
</div>

<asp:TextBox ID="txtDate" runat="server"  
            onkeydown="AllowDate(event);"
            width="90px" MaxLength="10"></asp:TextBox>
           
<asp:ImageButton ID="ImageButton1" runat="server" style="float: right"  ImageUrl="../Images/DateSelector.gif" />

<asp:RequiredFieldValidator ID="txtDateRequiredFieldValidator"
        ControlToValidate="txtDate"
        Text="*" display="static"
        runat="server" />
image1.png
image2.png
0
 
LVL 22

Expert Comment

by:Mrunal
ID: 40370790
sir, it's width's issue.
the parent control(tag) which contains textbox and image might not have sufficient width to have both side by side.

in this case create a css class like below:

.fLeft
{
  float: left;
}

and assign this class to both textbox and image.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:HLRosenberger
ID: 40370795
Ah, if I add ImageAlign="Top" , that seems to work.
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 40370799
wait.   ImageAlign="Top"  did not help.  my mistake.
0
 
LVL 1

Accepted Solution

by:
HLRosenberger earned 0 total points
ID: 40370846
This works:

<table>
<tr>

<td valign="top">
    <asp:TextBox ID="txtDate" runat="server" onkeydown="AllowDate(event);" width="90px" MaxLength="10"></asp:TextBox>
</td>

<td valign="middle">
    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="../Images/DateSelector.gif" />
</td>

<td valign="middle">
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                            ControlToValidate="txtDate" Text="*" display="static" runat="server" />
</td>


</tr>
</table>
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 40379423
this worked.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 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