.NETGURU
retain text in box
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngrichtextbox' list.


Ricki Williams
I'm using the RTB on a page that has multiple panels. I'm navigating =
through the panels with a next and back button that sets the proper =
panel to visible or not visible. When I set the panel with the RTB to =
not visible I lose the text that was in the box. How can I keep that =
text there?

Thanks,
RIcki

Reply to this message...
 
    
Jeff Widgren
I have a page that contains 14 different RTB controls that had to be
collapsed or expanded at any given time. What worked very well for me
was the use of <asp:panel> control that renders to a <div> tag. Then I
just wrote some client-side code to hide or show the panels by changing
the "display" style property.

Hope this helps!

Jeff Widgren
Click here to reveal e-mail address

-----Original Message-----
From: Ricki Williams [mailto:Click here to reveal e-mail address]
Sent: Monday, July 22, 2002 3:19 PM
To: aspngrichtextbox
Subject: [aspngrichtextbox] retain text in box

I'm using the RTB on a page that has multiple panels. I'm navigating
through the panels with a next and back button that sets the proper
panel to visible or not visible. When I set the panel with the RTB to
not visible I lose the text that was in the box. How can I keep that
text there?

Thanks,
RIcki

| [aspngrichtextbox] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngrichtextbox.asp = JOIN/QUIT

Reply to this message...
 
    
Ollie Cornes

Ricki,

The current version of RichTextBox doesn't work well in the scenario you
have. If you hide it, the document is cleared. This will be fixed in the
next release, but for now Jeff's solution will work well. His solution
may actually be better as it avoids a round-trip to the server and so
the experience for the user will be a little better.

I'm sorry for the problems this issue has caused - it will be sorted
out.

Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET

[Original message clipped]

Reply to this message...
 
    
Julian Voelcker
I've hit this problem doing exactly the same thing and it seems that
RTB isn't maintaining state, although I understand this is due to be
fixed in the next release.

To get around it I just load the contents into viewstate using:-

public string pageContent {
get {
if(ViewState["pageContent"]!=null)
return ViewState["pageContent"].ToString();
else
return "";
}
set {
ViewState["pageContent"] = value;
}
}

When you hide the panel that RTB is on I use:-

pageContent = RichTextBox1.TextXhtml.ToString();

And then when I display it I use:-

RichTextBox1.Text = pageContent;

THat seems to do the job.

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

Reply to this message...
 
    
Ricki Williams
Thanks for your help with this. I'm having an issue with it though. =
Right now, I'm going back to the server for showing and hiding my =
panels. So, in effect my pageContent property is getting reset with =
each postBack. I'm new with .net so I'm certain there is a better way =
to do this. Any suggestions?

-----Original Message-----
From: Julian Voelcker [mailto:Click here to reveal e-mail address]
Sent: Tuesday, July 23, 2002 6:29 AM
To: aspngrichtextbox
Subject: [aspngrichtextbox] Re: retain text in box

I've hit this problem doing exactly the same thing and it seems that
RTB isn't maintaining state, although I understand this is due to be
fixed in the next release.

To get around it I just load the contents into viewstate using:-

public string pageContent {
get {
if(ViewState["pageContent"]!=3Dnull)
return ViewState["pageContent"].ToString();
else
return "";
}
set {
ViewState["pageContent"] =3D value;
}
}

When you hide the panel that RTB is on I use:-

pageContent =3D RichTextBox1.TextXhtml.ToString();

And then when I display it I use:-

RichTextBox1.Text =3D pageContent;

THat seems to do the job.

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

| [aspngrichtextbox] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngrichtextbox.asp =3D =
JOIN/QUIT

Reply to this message...
 
    
Ollie Cornes

Hi Ricki,

I'm sorry you've got problems. This issue is caused because RichTextBox
is not correctly maintaining the state across postbacks when it is
Visible=false. This will be fixed in the next release, but for now your
two options top work around it are:

1. Use Julian's code to save the document in the ViewState object
between postbacks.
2. Use a client-side solution to hide the editor.

Does that help?

Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET

[Original message clipped]

Reply to this message...
 
    
Ricki Williams
Any idea when the next release is due?

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: Saturday, July 27, 2002 8:00 AM
To: aspngrichtextbox
Subject: [aspngrichtextbox] Re: retain text in box

Hi Ricki,

I'm sorry you've got problems. This issue is caused because RichTextBox
is not correctly maintaining the state across postbacks when it is
Visible=3Dfalse. This will be fixed in the next release, but for now =
your
two options top work around it are:

1. Use Julian's code to save the document in the ViewState object
between postbacks.
2. Use a client-side solution to hide the editor.

Does that help?

Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET

[Original message clipped]

| [aspngrichtextbox] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngrichtextbox.asp =3D =
JOIN/QUIT

Reply to this message...
 
 
System.Windows.Forms.RichTextBox




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification