Solved

Help with user control; textbox and image

Posted on 2014-10-09
7
174 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

821 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