Solved

Help with user control; textbox and image

Posted on 2014-10-09
7
160 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
Comment Utility
have you tried below css property:

float: right;

for image
0
 
LVL 1

Author Comment

by:HLRosenberger
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

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

Author Comment

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

Accepted Solution

by:
HLRosenberger earned 0 total points
Comment Utility
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
Comment Utility
this worked.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

17 Experts available now in Live!

Get 1:1 Help Now