How do I stop a user from incresing the height of TextBox - asp.net

I have an <asp:TextBox TextMode="MultiLine" Height=350 Width="200"> and have elements around it.
I don't want to allow the user to change the height and width of the asp:TextBox because it messes with the alignment of other elements around it.
Solution?

[Answer added for future reference]
You can use resize: none; in CSS to disable the resize-functionality offered by Firefox/Safari. An example and explanation can be found here.
(thanks to BoltClock)

If you want to add it in your textbox tag, you can do it like this:
<asp:TextBox ID="TextBox7" runat="server" MWidth="245px" Height="245px"
TextMode="MultiLine" style="resize:none"></asp:TextBox>

Related

Applying the CSS or changing format of label tooltip

I have used a Label in a repeater control, which shows a tool tip. However, it is too small and is difficult to read. So I would like to change the format (apply css) to that tool tip.
Any ideas?
<td align="left" style="width: 145px">
<asp:Label ID="lblItem" Text='<%# Eval("Add1").ToString().Substring(0, Math.Min(Eval("Add1").ToString().Length, 20))+"..." %>'
ToolTip='<%# Eval("Add1")%>' runat="server" />
</td>
Use jQuery to show tool-tip, its best solution for this, see following link which can be help full to you.
Animated Tooltip Javascript this will be very useful, and surely its working because I had already used them.

how to place control in a td

I try to set two control in a td.
1. use a panel. as follow.
<td style="display: inline;">
<asp:Panel ID="pContainer" runat="server" Wrap="false">
<telerik:RadTextBox ID="rtxtBookingID" runat="server"></telerik:RadTextBox>
<asp:RequiredFieldValidator ID="rfvBookingID"
runat="server" ControlToValidate="rtxtBookingID" ErrorMessage="|Booking ID"
Display="Dynamic"></asp:RequiredFieldValidator>
<telerik:RadButton ID="rbtnOpen" runat="server" Text="Browse" OnClientClicked="openViewWindow()"/>
</asp:Panel>
</td>
how to solve the problem.
if I use two td to place the two control . but the first control in the td will gernerate a div. so the two control distance is far?
As long as it works and you get ok behaviour you are fine and for layout issues you should use css. The way you place the controls on the page also depends on overall page design and structure, keep in mind that usage of tables to control layout is not promoted anymore and you should use divs and css whenever possible... again depending on whole page design of course.

How can I make a TextBox control that is multiline not be resizable?

How can I make a TextBox control that is multiline not be resizable?
I am using asp.net with c# and I can't find an option to do this
You should be able to disable textarea resizing in Chrome and Safari with this css:
textarea {
resize: none;
}
Not preferred code, but this worked for me. This style overwrites the css
<asp:TextBox id="tb5" TextMode="multiline" style="resize:none" width="330px" Height="50px" wrap="true" runat="server" />
I am using the following method and it works most on most of them;
.mymultitextboxclass{max-height:100px;min-height: 100px;max-width:400px;min-width:400px;}
then set this css class to your MultiLine Textbox. see it : http://jsfiddle.net/tugberk/RKcbn/
There is no such option on the control.
This completely depends on the browser and how it renders textboxes.
You can control this via the CSS resize property, though this is browser dependent.
Create a CSS class as follows:
.MultiLineTextBox
{
resize: none;
}
Then in the code of textbox,
<asp:TextBox ID="txtAdd" runat="server" TextMode="MultiLine" BorderStyle="Inset"
CssClass="MultiLineTextBox"></asp:TextBox>

Why a radiobuttonlist always take a new row?

This is a question about layout. I'm developing a .net page, whenever I add a radiobuttonlist right after a label, it comes down to next row. But in the code side, it still within the same row. The problem is if you browse it in IE, it comes down to the next row. I am sure the width of both label and radiobuttonlist is not oversized. What's the reason and how to resolve this issue? Thanks in advance.
RadioButtonList by default renders as table. You can change set the property RepeatLayout="Flow" and it will be rendered in span.
RepeatLayout Property
Different ways it can render
Add a property to your radiobuttonlist
RepeatDirection="Horizontal"
<asp:RadioButtonList RepeatDirection="Horizontal"
ID="RadioButtonList1" runat="server" style="display:inline">
<asp:ListItem>asdf</asp:ListItem>
<asp:ListItem>sdfg</asp:ListItem>
</asp:RadioButtonList>
this will solve your problem. CHEERS
You can set it's display style to be inline:
<asp:RadioButtonList
ID="RadioButtonList1" runat="server" style="display:inline">
<asp:ListItem>asdf</asp:ListItem>
<asp:ListItem>sdfg</asp:ListItem>
</asp:RadioButtonList>
Warning: Purists will scream that information should be in a CSS class somewhere else.
if you have apply css on page, then it is hard to maintain style of radiobuttonlist.
Mine was fix with below code
#radiobuttonlist label
{
vertical-align: super;
}

asp.net datalist - change styling

<asp:DataList ID="ItemsList" RepeatDirection="Vertical" runat="server">
<ItemTemplate>
<asp:LinkButton
ID="SecondLevelItem" runat="server" CommandName="second"
OnCommand="SecondLevelItem_Onclick" CommandArgument="<%# Container.DataItem %>"
Text="<%# Container.DataItem %>" >
</asp:LinkButton>
</ItemTemplate>
</asp:DataList>
everything works fine. except that I do not have any control over the styling on the items. I mean I have the styling on the datalist externally but I want to add some spacing (vertically) between each item. How do I do tht? Thanks
In general, to control style, you can apply the <ItemStyle> tag inside the <asp:DataList>.
You can optionally inject CSS properties into the asp:LinkButton tag, either with the class attribute or directly with style, controlling the height or other CSS properties.
If it's applicable, you can still add a on the bottom of the template (but this will add a vertical space to the last item too, and I don't know if you want it).
Hope to have been of help.
In the code behind databound method for the list, you may be able to add a css class via the attributes collection.
In fact you may be able to that declartively too, just checking now...
eg asp:DataList id="blah" runat="server" ItemStyle-CssClass="someClass"

Resources