How to use RichTextBox in codebehind

Discussion in 'ASP.NET / ASP.NET Core' started by nature, Oct 27, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. 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>
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    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
     
  3. 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>
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    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
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page