Solved

Help with user control; textbox and image

Posted on 2014-10-09
7
168 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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 …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

774 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