|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
contenteditablethis 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 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[i] is TextBox) { ((TextBox)contols[i] ).ReadOnly=true; } if(contols[i].HasControls) { SetToReadOnly(contols[i].Controls); } } } Show quoteHide quote "Michael Richter" <MichaelRich***@discussions.microsoft.com> wrote in message news:EC1B7885-E340-42ED-92EA-96354ED48D0E@microsoft.com... > 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 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 Show quoteHide quote "Daniel Fisher(lennybacon)" wrote: > 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[i] is TextBox) > { > ((TextBox)contols[i] ).ReadOnly=true; > } > if(contols[i].HasControls) > { > SetToReadOnly(contols[i].Controls); > } > } > } > > > -- > Daniel Fisher(lennybacon) > http://www.lennybacon.com
2.0 menu control and color
Dropdownlist: SelectedValue which is invalid VS2005 Designer does NOT display asp:panels!! Why? Coding issue Formview current Row Access db with login control View State problem when multiple user work on the same page Custom Buttons Login control tutorial Webparts design mode question |
|||||||||||||||||||||||