Solved

contents of a html cell

Posted on 2011-03-01
13
191 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
Independent Software Vendors: 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!

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

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 …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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)

749 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