1

How do you make a textfield readonly in DotNetNuke?

I have this code but its not working:

DnnFormTextBoxItem.Enabled = false;
Chris Hammond
  • 8,873
  • 1
  • 26
  • 34
Owen Lilly
  • 171
  • 3
  • 10

2 Answers2

1

In DotnetNuke, I only use dnn tag for text editor, with text field I use asp:TextBox tag and it can be disable or set readonly. But if you use dnn:Texteditor then there is no way to disable or set it to readonly. It only can be setted to visible or invisible.

Another solution for disable a texteditor in DotnetNuke is to retrive value from texteditor and paste it to a label then hide the text editor.

I have a short code here in C#. Imagine that you have a TextEditor1 and Label1 controls in your page and they are stay side-to-side to other but Label1 have an empty value. There is the code behind to setting an attribute for DNN TextEditor:

string teValue = TextEditor1.Value;
Label1.Text = teValue;
TextEditor1.Visible = false;

In the code above, you will show value of TextEditor1 in a Label (Label1) and then hide the TextEditor1 control, so that user only see the content of DNN TextEditor but nolonger be able to edit it after doing some post-back.

Tri Nguyen Dung
  • 929
  • 2
  • 13
  • 24
0

I have seen people use

<dnn:DnnFormLiteralItem>

In my modules, I use the standard

<asp:TextBox>
Simcha Khabinsky
  • 1,970
  • 2
  • 19
  • 34