Solved

Component placement

Posted on 2004-03-23
40
271 Views
Last Modified: 2008-03-10
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
Comment
Question by:leebee300
  • 15
  • 15
  • 10
40 Comments
 
LVL 31

Expert Comment

by:alorentz
ID: 10657265
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
 

Author Comment

by:leebee300
ID: 10657378
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10657410
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
 

Author Comment

by:leebee300
ID: 10657424
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10657441
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
 

Author Comment

by:leebee300
ID: 10657473
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10657474
What the hell?  Now if doesn't work for me either!  Strange.....
0
 

Author Comment

by:leebee300
ID: 10657503
very strange isn`t it
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10657514
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10657531
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
 

Author Comment

by:leebee300
ID: 10657564
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10657600
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10657605
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
 

Author Comment

by:leebee300
ID: 10657639
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10657727
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
 

Author Comment

by:leebee300
ID: 10657751
thanks Alorentz, points are dissappearing fast with no readies to replace them, so I will have to be extra careful now
0
 
LVL 6

Expert Comment

by:sforcier
ID: 10657870
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
 

Author Comment

by:leebee300
ID: 10657924
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
 
LVL 6

Expert Comment

by:sforcier
ID: 10657972
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
 

Author Comment

by:leebee300
ID: 10658004
a fair point, it worst comes to the worst I will try it.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 31

Expert Comment

by:alorentz
ID: 10658045
It will work, but if will defeat the purpose of web form controls and ASP.Net
0
 

Author Comment

by:leebee300
ID: 10658067
thanks Alorentz, couldn`t have put it better myself
0
 
LVL 6

Expert Comment

by:sforcier
ID: 10658163
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
 

Author Comment

by:leebee300
ID: 10658190
if your going to discuss it on my post could you also please try to find a solution for me please aswell guys.
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10658204
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10658225
>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
 

Author Comment

by:leebee300
ID: 10658249
get a sense of humour Alorentz I was joking with that post
0
 
LVL 6

Expert Comment

by:sforcier
ID: 10658252
Ok, change the repeatLayout to "Flow" that should do it.
0
 
LVL 6

Expert Comment

by:sforcier
ID: 10658262
you gotta put the smiley face on the end for a joke, it's really hard to tell the tone of text. ;)
0
 

Author Comment

by:leebee300
ID: 10658265
nope unfortunately I put that command in the <body> section but it had no affect at all.
0
 

Author Comment

by:leebee300
ID: 10658269
ok :)
0
 
LVL 6

Expert Comment

by:sforcier
ID: 10658272
try in the radio control. Use the Dev Environment.
0
 
LVL 6

Expert Comment

by:sforcier
ID: 10658284
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10658285
>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
 
LVL 6

Expert Comment

by:sforcier
ID: 10658296
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
 
LVL 31

Expert Comment

by:alorentz
ID: 10658306
I stand corrected!!!  I will bury my head in the sand!
0
 
LVL 6

Expert Comment

by:sforcier
ID: 10658323
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
 
LVL 6

Accepted Solution

by:
sforcier earned 50 total points
ID: 10658344
No need for that, so long as leebee's happy!?  :)
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10658499
Now you know why I'm in ASP Area, not .Net... ;-)
0
 

Author Comment

by:leebee300
ID: 10658531
thanks for the help you two, you have helped me a lot :)
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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

760 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

25 Experts available now in Live!

Get 1:1 Help Now