Wednesday, March 28, 2012
Text boxes and read-only text
I have a page representing several fields for stored data. If the user has
sufficient access privileges, the page is rendered w/ read/write text boxes
and
they can edit the various fields as needed. However, if the user doesn't ha
ve
sufficient privileges (i.e. view only), the page is rendered w/ the text box
es
set to read-only. However, this results in a rather clunky looking page, an
d
if there is more text in a box than can be rendered w/i the specified box
height, then the user must scroll. Further, when printing the page, the tex
t
is clipped to the box.
So, my thought has been to re-design the page to use two different controls
for
each text field: a text box for read/write, and a label (static text) for
read-only. My thought that it will result in a much cleaner view page, and
printing will be as expected. The negative is that there are then two contr
ols
for each field, and I must hide/show the appropriate control depending on th
e
read-write/read-only status.
Is there a better way to do this that doesn't rely on two controls for each
control?
Thanks for any thoughts and insights.What is your browser base?
If you know that it is IE only..
check out contenteditable... basically it allows any html element to be
editable..
http://msdn.microsoft.com/library/d...enteditable.asp
so you could do
<div contenteditable="true">This text it editable</div>
for those that have read write..
then simply change the flag to false if it is readonly,
This means printing doesnt get cliped either.
To make it so that you can still reference input ins your code you can do
<div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
this.innerText;">This text it editable</div>
<input type="hidden" name="BodyInput" value="">
then you simple get the data from the this.BodyInput.value property on the
server.
Not sure if this is what you are after but it may give you ideas as to where
to go from here.
"Julie" <julie@.nospam.com> wrote in message
news:40A1967F.D6ACF7C2@.nospam.com...
> I'm wondering what standard/best practices are for the following scenario:
> I have a page representing several fields for stored data. If the user
has
> sufficient access privileges, the page is rendered w/ read/write text
boxes and
> they can edit the various fields as needed. However, if the user doesn't
have
> sufficient privileges (i.e. view only), the page is rendered w/ the text
boxes
> set to read-only. However, this results in a rather clunky looking page,
and
> if there is more text in a box than can be rendered w/i the specified box
> height, then the user must scroll. Further, when printing the page, the
text
> is clipped to the box.
> So, my thought has been to re-design the page to use two different
controls for
> each text field: a text box for read/write, and a label (static text) for
> read-only. My thought that it will result in a much cleaner view page,
and
> printing will be as expected. The negative is that there are then two
controls
> for each field, and I must hide/show the appropriate control depending on
the
> read-write/read-only status.
> Is there a better way to do this that doesn't rely on two controls for
each
> control?
> Thanks for any thoughts and insights.
Darren Clark wrote:
> What is your browser base?
> If you know that it is IE only..
> check out contenteditable... basically it allows any html element to be
> editable..
> http://msdn.microsoft.com/library/d...enteditable.asp
> so you could do
> <div contenteditable="true">This text it editable</div>
> for those that have read write..
> then simply change the flag to false if it is readonly,
> This means printing doesnt get cliped either.
> To make it so that you can still reference input ins your code you can do
> <div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
> this.innerText;">This text it editable</div>
> <input type="hidden" name="BodyInput" value="">
> then you simple get the data from the this.BodyInput.value property on the
> server.
> Not sure if this is what you are after but it may give you ideas as to whe
re
> to go from here.
Thanks for the link and info, I'll look into it.
And, yes, my target is IE.
Text boxes and read-only text
I have a page representing several fields for stored data. If the user has
sufficient access privileges, the page is rendered w/ read/write text boxes and
they can edit the various fields as needed. However, if the user doesn't have
sufficient privileges (i.e. view only), the page is rendered w/ the text boxes
set to read-only. However, this results in a rather clunky looking page, and
if there is more text in a box than can be rendered w/i the specified box
height, then the user must scroll. Further, when printing the page, the text
is clipped to the box.
So, my thought has been to re-design the page to use two different controls for
each text field: a text box for read/write, and a label (static text) for
read-only. My thought that it will result in a much cleaner view page, and
printing will be as expected. The negative is that there are then two controls
for each field, and I must hide/show the appropriate control depending on the
read-write/read-only status.
Is there a better way to do this that doesn't rely on two controls for each
control?
Thanks for any thoughts and insights.What is your browser base?
If you know that it is IE only..
check out contenteditable... basically it allows any html element to be
editable..
http://msdn.microsoft.com/library/d...enteditable.asp
so you could do
<div contenteditable="true">This text it editable</div>
for those that have read write..
then simply change the flag to false if it is readonly,
This means printing doesnt get cliped either.
To make it so that you can still reference input ins your code you can do
<div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
this.innerText;">This text it editable</div>
<input type="hidden" name="BodyInput" value=""
then you simple get the data from the this.BodyInput.value property on the
server.
Not sure if this is what you are after but it may give you ideas as to where
to go from here.
"Julie" <julie@.nospam.com> wrote in message
news:40A1967F.D6ACF7C2@.nospam.com...
> I'm wondering what standard/best practices are for the following scenario:
> I have a page representing several fields for stored data. If the user
has
> sufficient access privileges, the page is rendered w/ read/write text
boxes and
> they can edit the various fields as needed. However, if the user doesn't
have
> sufficient privileges (i.e. view only), the page is rendered w/ the text
boxes
> set to read-only. However, this results in a rather clunky looking page,
and
> if there is more text in a box than can be rendered w/i the specified box
> height, then the user must scroll. Further, when printing the page, the
text
> is clipped to the box.
> So, my thought has been to re-design the page to use two different
controls for
> each text field: a text box for read/write, and a label (static text) for
> read-only. My thought that it will result in a much cleaner view page,
and
> printing will be as expected. The negative is that there are then two
controls
> for each field, and I must hide/show the appropriate control depending on
the
> read-write/read-only status.
> Is there a better way to do this that doesn't rely on two controls for
each
> control?
> Thanks for any thoughts and insights.
Darren Clark wrote:
> What is your browser base?
> If you know that it is IE only..
> check out contenteditable... basically it allows any html element to be
> editable..
> http://msdn.microsoft.com/library/d...enteditable.asp
> so you could do
> <div contenteditable="true">This text it editable</div>
> for those that have read write..
> then simply change the flag to false if it is readonly,
> This means printing doesnt get cliped either.
> To make it so that you can still reference input ins your code you can do
> <div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
> this.innerText;">This text it editable</div>
> <input type="hidden" name="BodyInput" value="">
> then you simple get the data from the this.BodyInput.value property on the
> server.
> Not sure if this is what you are after but it may give you ideas as to where
> to go from here.
Thanks for the link and info, I'll look into it.
And, yes, my target is IE.
Text editor in ASP.Net
No no not what I meant. I must make myself clear. I mean a free WYSIMYG editor tool such as this: http://www.telerik.com/r.a.d.editor/Default.aspx?Tab=Examples
Now I've found one. http://www.freetextbox.com/ .
Maybe anynone would recommend others?
I've seen this one in the past and been pretty impressed with it htmlArea (http://www.interactivetools.com/products/htmlarea/)
It looks pretty similar to the one you posted mind.
That reaaly looks nice, and it is completely JS and DHTML. Have you tried to do something like what is shown in the examplehttp://www.interactivetools.com/products/articlemanager/? I will make a simple content management system with a tree view of the pages and with an overview of the content of each page with an oppertunity of saving the changes
i used htmlArea for a client's backend enabling them to change parts of their sites frontend and it worked really nice.
ok how do you store the information? To a database which include the content or? If you could sent a link to a demo it would be great
I don't want get involved in this, but there is a IE only way to use an iframe as an html editor. I talked about it in the forum about a month ago. n/m that htmArea is just like it.
Tuesday, March 13, 2012
Textbox array?
What is it your trying to do?
to make a control array in .NET you create for example 3 textboxes named text1,text2,text3 respectively. Then in the text1 change event(Or any event) where it says Handles you append the extra textbox names and events.
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged, TextBox3.TextChanged
I havnet figured out how to detect which textbox was used, but this fires the event for all 3 textboxes.
I havnet figured out how to detect which textbox was used, but this fires the event for all 3 textboxes.
The way to figure out which one is to cast the sender object to a textbox, then refer to the senders name.
Dim myTextBox As TextBox
myTextBox = CType(sender, TextBox)
If myTextBox.Name = TextBox1 Then
' Do your processing for textbox 1.
End If
If myTextBox.Name = TextBox2 Then
' Do your processing for textbox 2.
End If
I have a this sub:
Private Sub btnNulstil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNulstil.Click
txtKar1.Text = ""
txtKar2.Text = ""
txtKar3.Text = ""
txtKar4.Text = ""
txtKar5.Text = ""
End Sub
Imagine that I had 100 text boxes, I would'nt like to write the lines txtKarX.text ="" up to 100. How can I make this in a smart way?
good question.. and i have no earthly idea why microsoft got rid of control arrays.
But i would think you would loop thru them using some sort of Object collection thingy.