You are not logged in.
Hi guys,
I have a problem with the Xinha, while i'm runing it in asp.net
I've read some similar post's here, but there wasn't any solution of this problem.
The Xinha wokts well when I have it like this...
.........................................................................
var xinha_editors = xinha_editors ? xinha_editors :
[
'myTextArea'
];
.........................................................................
<textarea id="myTextArea" cols="20" name="myTextArea" rows="2"></textarea>
.........................................................................
There is no doubt abot it. But I need to have a control of the text area, so I need the parametr runat=server. But when I do that, the Xinha doesn't display.
Doesn't matter which case I use...
<textarea id="myTextArea" cols="20" name="myTextArea" rows="2" runat="server"></textarea>
or
<asp:TextBox ID="myTextArea" name="myTextArea" runat="server" TextMode="MultiLine"></asp:TextBox>
The problem is, when it is in plain HTML the ID atribute in renderet html remain same. But the atribute runat=server cause, that the server change the id to "some" unique ID, so in rendered html page it looks like this, for example...
<textarea name="ctl00$ContentPlaceHolder1$myTextArea1" id="ctl00_ContentPlaceHolder1_myTextArea1" cols="20" rows="2"></textarea>
The problem of this unique ID is, that it can change when you change context inyour aspx page. What I've done with diffrent Javascript plugin is, that I put there a parametr class="mytextarea" becase this class parametr is same all time. But there was diffrent definiton in Javascript function, so it does not work with xinha.
Could anyone pls help me solve this problem?
Thanks Lucas
Offline
If I understand correctly, the problem is that you don't know what the textarea's ID is going to be. But you need to tell Xinha.
So, one thing you could do is configure Xinha through a Javascript function that finds the textarea's ID based on a class name that you know, and passes that ID to the function. e.g.
var xinha_editors;
function makeXinha(textareaID) {
xinha_editors = xinha_editors ? xinha_editors :
[
textareaID
];
.............
}
function findTextareaAndMakeXinha() {
var id = document.getElementsByClassName("mytextarea")[0].id;
makeXinha(id);
}
Offline
Try this, ASP.NET engine should automatically bind the data for you:
var xinha_editors = xinha_editors ? xinha_editors :
[
'<%= myTextArea.ClientID %>'
];
Offline