Solved

Help with user control; textbox and image

Posted on 2014-10-09
7
175 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
Industry Leaders: 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

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

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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