Frage

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?

War es hilfreich?

Lösung

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 %>");
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top