Question

I'm quite new to html and asp.

The problem is that i've defined a textarea that resizes depending on the content it has (using javascript functions).

It works like a charm till i set that textarea to runat="server". Then the resizing doesn't work anymore.

Why is this? How can i fix it?

Was it helpful?

Solution

This could be due to changed id of controls have runat="server", you can user ClientIDMode="static" if you are using framework 4 or above or use the ClientID instead of id of control.

Using ClientIDMode

<textarea id="TextArea1" cols="20" rows="2" runat="server" ClientIDMode="static" ></textarea>

Using ClientID

<textarea id="TextArea1" cols="20" rows="2" runat="server" ></textarea>

In javascript

  TextArea1 = document.getElementById("<%= TextArea1.ClientID %>");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top