contenteditable

  • Thread starter Michael Richter
  • Start date
M

Michael Richter

hi, all,

this is my first attempt in this newsgroup so please be forbearing if I am
posting to the wrong newsgroup or the question might be some kind of rtfm ;-).
I actually have a little problem in understanding the contenteditable
property. MSDN2 declares this as a good thing to use if wanting a form to be
not editable by the user. But there seem to be some restrictions.
I'm using VS.NET 2005 for my actual project and created a masterpage and
several content pages. Navigation and data access works fine but for
different users I want to have forms that are not editable but only showing
actual data. I could build a second form or page for this but I think to have
understood that the contenteditable property is my solution for the problem.
The content pages are all build with several controls like textbox,
dropdownlist, calendars and buttons embedded in a simple table to format the
page. I tried div and form with property contenteditable=false but the form
stayed editable. So I started to search MSDN2 and the www with Google but no
article solved my problem (or I overread it ;-) ). It seems that there must
be some kind of restrictions in the usage of contenteditable or some
prerequisites I did not care for yet.
Ok, now, has anybody a hint or a solution for my problem?

kind regards

Michael
 
D

Daniel Fisher\(lennybacon\)

The contenteditable attributecan be used to make the contents of a DIV
editable.

What you are searching for is the ReadOnly property of the asp:TextBox etc.
You can set these values by looping through the control tree:

SetToReadOnly(this.Page.Controls);


....

void SetToReadOnly(ContolCollection controls)
{
for(int i=0; i<contols.count; i++)
{
if( contols is TextBox)
{
((TextBox)contols ).ReadOnly=true;
}
if(contols.HasControls)
{
SetToReadOnly(contols.Controls);
}
}
}
 
M

Michael Richter

hi daniel,

so it was a problem with my English! content != elements != controls ... ;-)
grumble ...

ok, I wanted to avoid that looping, but if there is no other possibility ...

thanks a lot and greetings from cologne (hit your webpage and read wuppertal
as your home)

michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,200
Latest member
LaraHunley

Latest Threads

Top