Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2011-03-21 08:07:39

xmotor
New member
Registered: 2011-03-21
Posts: 1

Asp.net runat=server atribute - Xinha does not display

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

#2 2011-03-21 15:39:42

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: Asp.net runat=server atribute - Xinha does not display

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

#3 2011-03-24 17:16:26

punkin
New member
Registered: 2011-03-23
Posts: 4

Re: Asp.net runat=server atribute - Xinha does not display

Try this, ASP.NET engine should automatically bind the data for you:

var xinha_editors = xinha_editors ? xinha_editors :
[
  '<%= myTextArea.ClientID %>'

];

Offline

#4 2011-03-26 08:15:31

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: Asp.net runat=server atribute - Xinha does not display

Thanks punkin, that looks much simpler/cleaner than my suggestion, I don't know a thing about ASP.NET smile

Offline

Board footer

Powered by FluxBB