• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Component placement

I am trying to place a textbox next to a radiobuttonlist, asp.net puts a line break between them by default. Can this be stopped so the they are both on the same line on the webpage ???
0
leebee300
Asked:
leebee300
  • 15
  • 15
  • 10
1 Solution
 
alorentzCommented:
Maybe you'll post the HTML for the whole page in this post?  The 2 object stay on the same line unless you force them to break lines.  So there is somehting else in your HTML that is causing the problem.  I tried to tell you that in the previous question.
0
 
leebee300Author Commented:
I know Alorentz but I do not like posting the code, for certain reasons (not bad reasons obviously), I noticed on another website forum type thing someone else had the same problem but there where no solutions on that one either
0
 
alorentzCommented:
Well, the problem is somewhere in your HTML structure! If you put the code I gave last time in a new file with no tables, you'd see that they are on the same line, BY DEFAULT.  If you can't provide the information we need to help, how are we supposed to help?
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
leebee300Author Commented:
I know I know dont give me a hard time please, I will try your previous code in a new table, then if correct (which you usually are) I will have to re do the tables.
0
 
alorentzCommented:
Here it is again:

<asp:textbox id="TextBox1" runat="server"></asp:textbox>&nbsp;&nbsp;
<asp:radiobuttonlist id="testbutton" runat="server" RepeatDirection="Horizontal">
      <asp:ListItem Value="yes1">Yes</asp:ListItem>
      <asp:ListItem Value="no1">No</asp:ListItem>
</asp:radiobuttonlist>
0
 
leebee300Author Commented:
Alorentz, I tried this code, and it does default automatically on to a new line, try it, save it then access the file through a browser

<html>
<head>
</head>
<body>
    <form runat="server">
        <asp:TextBox id="test" runat="server" size="10"></asp:TextBox>
        <asp:RadioButtonList id="testbutton" runat="server" RepeatDirection="Horizontal">
            <asp:ListItem id="testYes" value="Ty" text="Yes" runat="server" />
            <asp:ListItem id="testNo" value="Tn" text="No" runat="server" />
        </asp:RadioButtonList>
    </form>
</body>
</html>
0
 
alorentzCommented:
What the hell?  Now if doesn't work for me either!  Strange.....
0
 
leebee300Author Commented:
very strange isn`t it
0
 
alorentzCommented:
Yes, I saw that...looks like your going to have to put in table cell:

<html>
<head>
</head>
<body>
    <form runat="server">
       <table>
           <tr>
               <td>
        <asp:TextBox id="test" runat="server" size="10"></asp:TextBox>
               </td>
                <td>
        <asp:RadioButtonList id="testbutton" runat="server" RepeatDirection="Horizontal">
            <asp:ListItem id="testYes" value="Ty" text="Yes" runat="server" />
            <asp:ListItem id="testNo" value="Tn" text="No" runat="server" />
        </asp:RadioButtonList>
               </td>
           </tr>
</table>
    </form>
</body>
</html>
0
 
alorentzCommented:
The problem is the the server side compiler builds the HTML table for it and puts it on a new line if one is not present in the code.  So you need to build in the structure.

OR, use absolute positioning for all the elements on the page.
0
 
leebee300Author Commented:
NNNOOOOOOOOO no no no no no, what a downer !!!!!!!! I have spent ages designing the table and I am practically at the end of the webpage, I have components everywhere !!!!!!!! is there definately no easy fix that you or any of your friends maybe aware of ????
0
 
alorentzCommented:
This is a function the .Net compiler, can't control that.  I assume you have these objects in the same table cell, an if nowrap didn't work, your sh@t out of luck!

Sorry.
0
 
alorentzCommented:
You'll see for the original code I gave you, that if you view source of the page, you'll see the built in HTML that you have no control over.
0
 
leebee300Author Commented:
yep its in the same table cell, funnily enough it defaults when I use the buttons in other cells, sh@t out of luck it looks like then, thanks for the help on this one anyway Alorentz (I will still search though, it seems that it could be too common a problem to have not been addressed by Microsoft(spot my niavety there !!!!))
0
 
alorentzCommented:
you can also try the .Net area instead of here in ASP.  They do all .Net there:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/

0
 
leebee300Author Commented:
thanks Alorentz, points are dissappearing fast with no readies to replace them, so I will have to be extra careful now
0
 
sforcierCommented:
Just a thought, but what if instead of using the <asp:RadioButton >, you just used the <INPUT type="radio" runat="server"> ?? I know it's the generic HTML object and it's not as robust on the codebehind, but it might resolve your formatting issue. I've not tried it myself, it's just a thought.
0
 
leebee300Author Commented:
yes it does work but it is defeating the object, and knowing Microsoft it will cause a problem somewhere along the line, but thanks for the idea anyway.
0
 
sforcierCommented:
How's it "defeating the object"? You sounded so despondant that you'll have to recode everything, why are you giving up on this so fast if it works? Just curious. Also, if ASP.NET stops supporting generic HTML objects, then more people than you will have a problem. ;)
0
 
leebee300Author Commented:
a fair point, it worst comes to the worst I will try it.
0
 
alorentzCommented:
It will work, but if will defeat the purpose of web form controls and ASP.Net
0
 
leebee300Author Commented:
thanks Alorentz, couldn`t have put it better myself
0
 
sforcierCommented:
Could you explain to me why alorentz?

If all I want is to know the selected value, and I'm not trying to process events on the radio button, what's the harm? It's just a way of retreiving information from the user. What is the difference between an <asp:RadioButton runat="server"> and an <input type="radio" runat="server"> aside from the more generic interface of the latter in the codebehind?
0
 
leebee300Author Commented:
if your going to discuss it on my post could you also please try to find a solution for me please aswell guys.
0
 
alorentzCommented:
ASP.Net is application based and there is more to it than just knowing a value.  There are several additions functional capabilities of server controls, and additional coding necessary to incorporate old ASP objects into ASP.Net.  I guess you'd need to write an ASP.Net app to see what I'm talking about, it's a whole new world...
0
 
alorentzCommented:
>if your going to discuss it on my post could you also please try to find a solution for me please aswell guys.

Told you how to do it....just doesn't suit your code now.  Post to .Net area...you're not going to get much help for this here because this is basically classic ASP area.
0
 
leebee300Author Commented:
get a sense of humour Alorentz I was joking with that post
0
 
sforcierCommented:
Ok, change the repeatLayout to "Flow" that should do it.
0
 
sforcierCommented:
you gotta put the smiley face on the end for a joke, it's really hard to tell the tone of text. ;)
0
 
leebee300Author Commented:
nope unfortunately I put that command in the <body> section but it had no affect at all.
0
 
leebee300Author Commented:
ok :)
0
 
sforcierCommented:
try in the radio control. Use the Dev Environment.
0
 
sforcierCommented:
I just tried the original code and it didn't work. Then I changed the radio control's property as I suggest  and it works.
0
 
alorentzCommented:
>Ok, change the repeatLayout to "Flow" that should do it.

The HTML for the server control is auto generated, so flow can't effect it, because compiler puts it in tables.
0
 
sforcierCommented:
Here's the HTML that the design view generates:

<asp:TextBox id="test" runat="server" size="10"></asp:TextBox>
<asp:RadioButtonList id="testbutton" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
      <asp:ListItem Value="Ty">Yes</asp:ListItem>
      <asp:ListItem Value="Tn">No</asp:ListItem>
</asp:RadioButtonList>
0
 
alorentzCommented:
I stand corrected!!!  I will bury my head in the sand!
0
 
sforcierCommented:
Yah, the HTML is generated by the server. But if you tell the server to generate the HTML using "Flow" instead of "Table" the compiler won't use tables, no? All I know is I could replicate the problem and resolve it on my system, it's just a matter of getting it to work for leebee300.
0
 
sforcierCommented:
No need for that, so long as leebee's happy!?  :)
0
 
alorentzCommented:
Now you know why I'm in ASP Area, not .Net... ;-)
0
 
leebee300Author Commented:
thanks for the help you two, you have helped me a lot :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 15
  • 15
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now