aspx radiobutton control list in one line - asp.net

http://www.codetoad.com/asp.net/aspnetcontrols11.asp
Is it possible to have radiobutton control list in one row. Now it is in 3 rows.

You need to use the RepeatDirection and RepeatLayout properties of the RedioButtonList control.
There are several ways of getting the layout you want - I suggest reading the documentation of both properties in order to make an informed decision on which one is most suitable for your situation.

In your RadioButtonList set the property of RepeatLayout="Flow" and RepeatDirection="Horizontial". This will make items in a radio button list horizontal instead of vertical.

Why dont you try adding each radio button to <div> or <li> tag and then set float:left in Css for each <li>. That way i think it will render in one line. Just make sure to set width:__ style to accommodate all radio buttons

Related

Xpages combobox size bigger then inputText size

I have a table with inputTexts and comboBoxes within it. In edit mode is all working fine, but in read mode, the text within the comboBoxes seem to have padding, but they don't. I checked with Chrome and it seem that the combobox has, by default, another element inside it, a table which contains the text.
Question: How can I remove that table inside the combobox in order for the elements to align better, withouth having to put margin-left and margin-top to the combobox?
Use custom renderers (which is the most elegant way but also advanced).
http://openntf.org/XSnippets.nsf/snippet.xsp?id=remove-table-tag-for-listboxes-in-read-mode-for-all-instances-in-one-go
You can use the rendered property. Show comboBox only if document is in editmode
rendered="#{javascript:document1.isEditable()}"
and add a computed field which shows the value as plain text with the rendered property
rendered="#{javascript:!document1.isEditable()}"
As an alternative, you can use Brad Balassaitis' solution from his blog. He deletes nested tables onClientLoad.
Or, you work with css classes.

How can I create alternating background colors for listview rows while only using ItemTemplate?

How can I create alternating background colors for listview rows while only using ItemTemplate? I don't want to use AlternateTemplate because I would have to edit both of them everytime i want to change something when all I'm using it for is to create the alternating background colors. So what's a way I could do it using only the ItemTemplate? Thanks!
If you could consider the alternating colours a progressive enhancement and not absolutely required in all (old) browsers then you could use a CSS n-th child selector to apply the colour without changing the HTML.
If you have jQuery (or similar) in your project already and want a solution for older browser, you could use that to select every other row with the :odd or :even selector.
Update (Example)
Assuming we are using table rows
tr:nth-child(odd) td{
background-color: red;
}
You can also use even, 2n or 2n+1. This would work equally well with <li> tags.
More examples: http://reference.sitepoint.com/css/pseudoclass-nthchild
This might work too:
Alternating Table Row Colors with ASP.Net ListView Control
It uses the <%# style syntax in your ASPX page to toggle the class based on the DisplayIndex Mod 2.
C# and VB code samples on that link too...
Use the ItemDataBound event of the ListView (if it has one like the Repeater does). Add a runat="server" element to your ItemTemplate that you can use to set the color using a class. Get a reference to this control in the event and set the css class.
Have you tried using a Repeater control, instead of the ListView.
You'll have more control over the template, and it's easier to change alternating colors, w/out having duplicate templates.

Adding two buttons next to an ExtJS ComboBox

I need to place an Add button and a Remove button next to an ExtJS ComboBox. It's critical for these three elements to be in a single line because I have to apply this to all other ComboBoxes in the fieldset too.
Please notice that the given ComboBoxes are items of a fieldset. Replacing the buttons with context menu items is not the desired solution.
Can you give me some ideas? Thanks in advance.
For this, you can place all the three elements - combobox and the two buttons - in a container with layout hbox. This will place all of them in the same line.
Hope this helps.
Ext.form.FieldContainer is the class you need.
It has a label and will layout nicely with your form, but can contain multiple fields and controls.

How to Add Radio Buttons to a Form Vertically?

I am dynamically creating radio button within code behind in ASP.Net, how do I add the controls so they appear vertically instead of horizontally?
RadioButtonList rbl = new RadioButtonList();
rbl.RepeatDirection = RepeatDirection.Vertical;
You can use RadioButtonList Control with RepeatDirection set to Vertical.
If that is not possible then....
Add them to a ordered list(OL element) or an unordered list(UL).
Possible two ways:
Give some CSS class, and in your css give that class some style like
display:block;
Use RadioButtonList control as container to those radio buttons. Set the "RepeatDirection" property to "Vertical".

asp.NET If then inside of DIV tag?

I have two menus based on someones credentials.
The menu is an UL within a wrapping DIV and I would like to place an If Then within that DIV to set is class dynamically.
Does anyone know if this is possible or if there is a better approach?
Thanks in advance!
Give the element an id and add the runat="server" attribute to it.
You can now access if from your code and set its attributes programmatically.
If its just a div, you can use asp:Panel instead -- asp:Panel will render a Div, and you can set its visibility in your code behind
Scratch that, actually that wont work.
I need to hide a specific list item and so what I will simply do is write that list item dynamically when the correct user is logged in.

Resources