Set aspnet textbox height based on text on page load - asp.net

I am looking to set the height of an aspnet textbox based on the amount of text so there is no need to scroll on page load when text is loaded from a database field. I need to do this in code behind so the height is stored on the server.
I am able to resize the textbox using javascript as text is entered or removed however I need this to also be done on page load and again that height be stored server side.
Any ideas?

Try using http://www.impressivewebs.com/textarea-auto-resize/ - In short, it's a jquery function that allows you to invoke a resize. Once referenced, use $('#myTextarea').autoResize(); on keyup, blur, whenever.. to invoke the resize function.
Credit: https://css-tricks.com/textarea-tricks/

Related

How to set the updatepanel as readonly when it's doing any operation?

I have an Tab control inside the update panel. Whenever the update progress started I want to make that update panel as readonly. Once the update progress is done then I want to make it to it's normal state.
Any help?
One way to do it is position a transparent DIV over the content. For example if update is triggered by a Button, the sequence can go like this:
On Button's ClientClick event - position the DIV over content and set its display style to "block"
In server-side code generate a JavaScript command to set DIVs display style back to "None"

Immediately clearing the contents of an IFrame in Flex

I have a Flex HTML component that is displaying content from a remote URL and a button in the Flex application that reloads the content. However, it takes a few seconds for the IFrame's content to refresh. During this time, there is no obvious feedback to the user that any action is underway.
I would like to clear the contents of the IFrame, so there is immediate feedback after clicking refresh, and then load the remote URL again. Is there a way to do this?
I've tried setting the HTMLText property to "" and setting the IFrame location to "about:blank", and neither of these have the desired immediate effect. (on it's own, setting the location to about:blank immediately clears the IFrame, but if it is followed by resetting the location to the original URL, the immediate clearing doesn't occur. Is this something to do with the IFrame caching the original page?)
One approach is to remove the component from the display list and add a new instantiated component back in its place.
This will assure fully initialized state.
One other way you could get around would be having a blank iframe or loading screen ready with the same size and same position, while the contents are being loaded, hide the content iframe, and show the blank iframe or loading screen. This could be much easier to achieve a more flexible result.

How to keep focus on Spark TextInput after setting StageWebView source

I have a mobile application that has a Text Input used for searching. Below the search TextInput is a StageWebView. When I set the source of the StageWebView using loadURL() the key input is shifted to the StageWebView.
How can I prevent this?
I think I figured out the problem. When you set the stage property (which is basically setting the visibility to true) that's when it steals the focus. I was showing and hiding the web view depending on if the text input had any text (I was updating the webview source on text change). The fix was to set the web view to visible before putting the cursor in the Text Input. As long as the visibility doesn't change the focus stays in the text input.
I dont know if there is a better way but my solution is to try to set the focus back to the textInput by using myText.setFocus() after your load routine.

how to setting form display

i have a form input..i've been made it using jquery...
i want my form show not too long..but actually it need to scroll the page in monitor..
how could i setting my form eventhought i have much item for input data??
i want my form show in one page (no need use scroll bar)..
You can make sure that the height of the page does not exceed the standard size.
Or you can use an Iframe inside a DIV.

How to populate long text in dropdownlist in asp.net

In asp.net, am trying to populate a dropdownlist box with very long text. I have fixed the width of list on the page and i don't want to change its size as it would affect my page layout. On clicking the dropdownlist, the text gets truncated to the size of the dropdown. I want to see the entire text without any truncation, without changing the size of the dropdownlist box..Also if there are any third party controls which would solve this problem?Would be very helpful if there's a solution for this.
Update:
Right now am trying a dropdown box in Jquery that will wrap the text if it exceeds the size..but again the problem is it works fine on an independent solution but when i integrate it with my application, it does not read the .css file and it does not do any formatting(style, font, alignment) that it is supposed to do according to the .css file.Any idea why this is happening?
The problem that you're describing is restricted to IE (it might be fixed in the latest version, I haven't tested).
In the past, I've had success with binding javascript methods to the onClick event on the drop down to increase the width, and the onBlur event to set the width back to its original value.
You might be able to use jQuery to create a tooltip like thing that appears when you hover over each option.
something like
// this executes on page load - just like asp.net Page_load()
function pageLoad(){
// attach a mouseover event to each option in your dropdown
$("#myDropdown option").mouseover(function(){
// get the text from that option
var text = $("#"+this.id).text();
// display that text in a small tooltip
showToolTip(text);
});
}
function showToolTip(text){
// display in some way
}
there's a javascript library called wz_tooltip available at walterzorn.com
hope that helps

Resources