PDA

View Full Version : How to use RichTextBox in codebehind


nature
10-27-2004, 07:59 AM
I tried this and it doesn't work. I'm using webmatrix to create .vb files for the codebehind.


Imports AspNetEmail</o:p>
Imports System</o:p>
Imports System.IO</o:p>
Imports System.NET</o:p>
Imports System.Data</o:p>
Imports System.xml</o:p>
Imports System.Collections</o:p>
Imports System.ComponentModel</o:p>
Imports System.Data.OleDb</o:p>
Imports RichTextBoxControl</o:p>
</o:p>
Public Class SendNewsletter</o:p>
Inherits System.Web.UI.Page</o:p>
Protected WithEvents RichTextBox1 As RichTextBoxControl.RichTextBox</o:p>
Protected WithEvents litMsg As System.Web.UI.WebControls.Literal</o:p>
Protected WithEvents dgMailMerge As System.Web.UI.WebControls.DataGrid</o:p>
Protected WithEvents txtEmailServer As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents txtEmailFrom As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents txtEmailTo As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents txtEmailSubject As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents litEmailBody As System.Web.UI.WebControls.Literal</o:p>
Protected WithEvents btnSubmit As System.Web.UI.HtmlControls.HtmlInputButton</o:p>
Protected WithEvents txtEmailBody As System.Web.UI.HtmlControls.HtmlTextArea</o:p>

bruce
10-27-2004, 10:23 AM
Hmm... i am not sure how to do that w/ webmatrix to build code behind.

1 thing for sure you need to do is to install the at least the trial version in to your GAC.

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

nature
10-27-2004, 11:26 AM
thanks but the questions wasn't how to do a codebehind but rather how would I reference richtexbox in a codebehind. I got the codebehind to work just fine. Since I'm using webmatrix, I have to do things the hard way.

<%@ Page Language="vb" autoeventwireup="false" Inherits="SendNewsletter" Src="SendNewsletter.vb" validaterequest="false" Debug="true" %>

The code behind starts as below. Given that, how do I reference the RichTextBoxControl? The code is bold is what I tried.

Imports AspNetEmail</o:p>

Imports System</o:p>
Imports System.IO</o:p>
Imports System.NET</o:p>
Imports System.Data</o:p>
Imports System.xml</o:p>
Imports System.Collections</o:p>
Imports System.ComponentModel</o:p>
Imports System.Data.OleDb</o:p>
Imports RichTextBoxControl</o:p>
</o:p>
Public Class SendNewsletter</o:p>
Inherits System.Web.UI.Page</o:p>
Protected WithEvents RichTextBox1 As RichTextBoxControl.RichTextBox</o:p>
Protected WithEvents litMsg As System.Web.UI.WebControls.Literal</o:p>
Protected WithEvents dgMailMerge As System.Web.UI.WebControls.DataGrid</o:p>
Protected WithEvents txtEmailServer As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents txtEmailFrom As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents txtEmailTo As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents txtEmailSubject As System.Web.UI.HtmlControls.HtmlInputText</o:p>
Protected WithEvents litEmailBody As System.Web.UI.WebControls.Literal</o:p>
Protected WithEvents btnSubmit As System.Web.UI.HtmlControls.HtmlInputButton</o:p>
Protected WithEvents txtEmailBody As System.Web.UI.HtmlControls.HtmlTextArea</o:p>

bruce
10-28-2004, 07:03 AM
I am just guessing here. I guess I am so used to using VS.net, i have no clue how to add the reference w/o the IDE.

Try add to your aspx file

<%@ Register TagPrefix='RTB' Namespace='RichTextBoxControl' Assembly='RichTextBox, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=17b15412cfbf13c1' %>

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)