This is a migrated thread and some comments may be shown as answers.

Controls that have a Label property

2 Answers 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 09 Nov 2010, 11:59 AM
When these controls render they do so in a table, label in one cell and control in another.

No problems so far.

However, if you've lots of these controls and the labels are all different lengths then you have the devils own job of getting your controls to stack nicely.

It would be nice if these controls rendered a class name in the <TD> tag (or better yet, had a LabelCssClass property where the <TD> and LabellCssClass property value could be used to write a CSS rule) so that the width could be set to a consistent value so that all the controls stacked neatly.

--
Stuart 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 09 Nov 2010, 06:03 PM
Hi Stuart,

You can use the following approach:

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls</title>
<style type="text/css">
 
.myLabel
{
    display:block;
    width:120px;
    margin-right:0 !important;
    padding-right:0 !important;
}
 
.RadComboBox .myLabel
{
    float:left;
}
 
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadTextBox ID="RadTextBox2" runat="server" Label="Label 1" LabelCssClass="myLabel" Width="300px" />
<br /><br />
<telerik:RadTextBox ID="RadTextBox1" runat="server" Label="Longer Label 2" LabelCssClass="myLabel" Width="300px" />
<br /><br />
<telerik:RadComboBox ID="RadComboBox1" runat="server" Label="Even Longer Label 3" LabelCssClass="myLabel" Width="180px" />
 
<div style="clear:both"><!-- --></div>
 
following content
 
</form>
</body>
</html>


Sincerely yours,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stuart Hemming
Top achievements
Rank 2
answered on 10 Nov 2010, 09:03 AM
Now I feel really silly!

How did I manage to miss that in the docs.

<sigh/> 

I really shouldn't be allowed to work unsupervised.

-- 
Stuart
Tags
General Discussions
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Stuart Hemming
Top achievements
Rank 2
Share this question
or