Solved

contents of a html cell

Posted on 2011-03-01
13
188 Views
Last Modified: 2012-05-11
I have a html table cell with 2 controls. Currently, the controls are stacked one on top of the other BUT I want them to be side by side. How do i do this
<td class="style20">
                                        <asp:label ID="txtDisplayProductOnline" runat="server" Text=""></asp:label>                                
                                                    <asp:RadioButtonList ID="rdDisplayOnline" runat="server" Height="18px" 
                                                        RepeatDirection="Horizontal" Width="115px">
                                                        <asp:ListItem Selected="True">Yes</asp:ListItem>
                                                        <asp:ListItem>No</asp:ListItem>
                                                    </asp:RadioButtonList>
                                    </td>

Open in new window

0
Comment
Question by:vbnetcoder
  • 6
  • 4
  • 2
  • +1
13 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 35012568
<table>
<tr>
<td>Control one goes here.</td><td>Control 2 goes here.</td>
</tr>
</table>

Open in new window

0
 
LVL 11

Accepted Solution

by:
jasonduan earned 250 total points
ID: 35012574
wrap the controls with <span> tags.
<td class="style20">
   <span><asp:label ID="txtDisplayProductOnline" runat="server" Text=""></asp:label></span>                                
    <span><asp:RadioButtonList ID="rdDisplayOnline" runat="server" Height="18px" 
                                                        RepeatDirection="Horizontal" Width="115px">
          <asp:ListItem Selected="True">Yes</asp:ListItem>
          <asp:ListItem>No</asp:ListItem>
    </asp:RadioButtonList></span>
</td>

Open in new window

0
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 35012576
<tr> = table row
<td> = columns in the table.

Something worth understanding is how <spans> work so that you can have some rows with 5 columns and some rows with 1 column or 2.
0
 

Author Comment

by:vbnetcoder
ID: 35012686
rawinnlnx9: I forgot to mention that these controls are not going to be visible at the same time.  I want them in exactly the same place if possible.

jasonduan: I tried you solution and it did not make a difference
0
 
LVL 3

Assisted Solution

by:dtocci
dtocci earned 250 total points
ID: 35014182
you can probably use jasonduan's solution but add some CSS to put the buttons on top of each other.  you need to specify the wrapper td as relatively positioned and each span as absolutely positioned inside of it.  something like this...

<td class="style20" style="position:relative">
   <span style="position:absolute;top:0;left:0;"><asp:label ID="txtDisplayProductOnline" runat="server" Text=""></asp:label></span>                                
    <span style="position:absolute;top:0;left:0;"><asp:RadioButtonList ID="rdDisplayOnline" runat="server" Height="18px" 
                                                        RepeatDirection="Horizontal" Width="115px">
          <asp:ListItem Selected="True">Yes</asp:ListItem>
          <asp:ListItem>No</asp:ListItem>
    </asp:RadioButtonList></span>
</td>

Open in new window

0
 

Author Comment

by:vbnetcoder
ID: 35018628
dtocci: they are stacked in design  view but not neither show on the screen when the program is run..
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

by:dtocci
ID: 35019098
Hmm.  Nothing in that code should make them disappear.  When you view the html source of the resulting page is anything outputting inside the <span> tags?

When you said "these controls are not going to be visible at the same time", do you mean they won't be rendered in the html code at the same time or they'll both be there but only one will be made visible at a time with CSS?  If it's the former, you don't even need the span tags because only one will appear at a time.  If it's the latter, then maybe something you've done in the CSS is making them invisible?
0
 

Author Comment

by:vbnetcoder
ID: 35019131
In my asp.net code I show them or hide them based on if it is in edit mode or view mode. They will not both be visible at the same time ever....
0
 

Author Comment

by:vbnetcoder
ID: 35019170
Actually, I noticed they ARE showing but not in the cell but instead in the top right of my screen
0
 
LVL 3

Expert Comment

by:dtocci
ID: 35019210
Then it sounds like you can just leave the code the way you had it when you posted the question. They may be stacked in design view but when the page is rendered only one should appear.  It would be impossible for them to be stacked or side-by-side if you only have one or the other rendering.  That should work unless I'm missing something.
0
 

Author Comment

by:vbnetcoder
ID: 35019249
I want them to appear in the same spot ... currently, the label control appears in on spot when  visible and the radio button control below it...

I will keep working on this.... I am rebuilding the form now it is all messed up
0
 
LVL 3

Expert Comment

by:dtocci
ID: 35019561
Just noticed your comment about how they are showing but not in the cell.  That means the <td> container is missing the  style="position:relative".  It needs that so that the position:absolute on the spans will work relative to it, instead of relative to the whole page.

Also, if you use that solution, you may want to set a width for the td cell as it will probably no longer stretch to accommodate what is inside it.  

I'm still not sure why the radio control would appear out of place if it is the only thing being rendered in the cell (without the span wrappers).
0
 

Author Closing Comment

by:vbnetcoder
ID: 35020872
ty
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

708 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

13 Experts available now in Live!

Get 1:1 Help Now