Solved

contents of a html cell

Posted on 2011-03-01
13
194 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
[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
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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
 
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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

630 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