Showing posts with label property. Show all posts
Showing posts with label property. Show all posts

Saturday, March 31, 2012

Text Box Control MaxLenght Property Is Not Working

Hi All,

I have developed one web application.
In that I used aspnet web textBox control.
I have set maxlength property for that text box 300 and TextMode property as
multiline .

When i typed more than 3 or 4 line each line contains 30 to 40 characters,
If i clicked button for passing textbox value, that time my web page is not
responsding (no action taken).

The same page without refereshing if i delete some characters from my
textbox.
It is working.

Can someone help me for this?

--
Regards,
DhanaDhana,

What browser are you using?

"Dhana" <dhana@.celtycs-consulting.com> wrote in message
news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I have developed one web application.
> In that I used aspnet web textBox control.
> I have set maxlength property for that text box 300 and TextMode property
> as multiline .
> When i typed more than 3 or 4 line each line contains 30 to 40 characters,
> If i clicked button for passing textbox value, that time my web page is
> not responsding (no action taken).
> The same page without refereshing if i delete some characters from my
> textbox.
> It is working.
> Can someone help me for this?
> --
> Regards,
> Dhana
A TextBox in MultiLine mode is rendered as a TextArea HTML control. TextArea
as opposed to an Imput control does not have a maxlength property. It will
be ignored in the TextBox.

There are some 3rd party controls and projects out there that attempt to
control length with javascript for a multiline textbox. I haven't used any
of them so can't comment.

--

Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org

"Dhana" <dhana@.celtycs-consulting.com> wrote in message
news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I have developed one web application.
> In that I used aspnet web textBox control.
> I have set maxlength property for that text box 300 and TextMode property
> as multiline .
> When i typed more than 3 or 4 line each line contains 30 to 40 characters,
> If i clicked button for passing textbox value, that time my web page is
> not responsding (no action taken).
> The same page without refereshing if i delete some characters from my
> textbox.
> It is working.
> Can someone help me for this?
> --
> Regards,
> Dhana
Ah yeah...

Try using a javscript function like:

function limitTextarea(textarea, maxlength) {
if (textarea.value.length > maxlength)
textarea.value = textarea.value.substring(0, maxlength);
}

and set the onchange attribute (either programatically with
textbox.attribute.add() or declaratively) on the textbox to call the
function.

"Andrew Robinson" <nemoby@.nospam.nospam> wrote in message
news:%23FQJ$5hDGHA.3820@.TK2MSFTNGP10.phx.gbl...
>A TextBox in MultiLine mode is rendered as a TextArea HTML control.
>TextArea as opposed to an Imput control does not have a maxlength property.
>It will be ignored in the TextBox.
> There are some 3rd party controls and projects out there that attempt to
> control length with javascript for a multiline textbox. I haven't used any
> of them so can't comment.
> --
> Andrew Robinson
> www.binaryocean.com
> www.bellinghamdotnet.org
>
> "Dhana" <dhana@.celtycs-consulting.com> wrote in message
> news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
>>
>> Hi All,
>>
>> I have developed one web application.
>> In that I used aspnet web textBox control.
>> I have set maxlength property for that text box 300 and TextMode property
>> as multiline .
>>
>> When i typed more than 3 or 4 line each line contains 30 to 40
>> characters,
>> If i clicked button for passing textbox value, that time my web page is
>> not responsding (no action taken).
>>
>> The same page without refereshing if i delete some characters from my
>> textbox.
>> It is working.
>>
>> Can someone help me for this?
>>
>> --
>> Regards,
>> Dhana
>>
>>
>>

Text Box Control MaxLenght Property Is Not Working

Hi All,
I have developed one web application.
In that I used aspnet web textBox control.
I have set maxlength property for that text box 300 and TextMode property as
multiline .
When i typed more than 3 or 4 line each line contains 30 to 40 characters,
If i clicked button for passing textbox value, that time my web page is not
responsding (no action taken).
The same page without refereshing if i delete some characters from my
textbox.
It is working.
Can someone help me for this?
Regards,
DhanaDhana,
What browser are you using?
"Dhana" <dhana@.celtycs-consulting.com> wrote in message
news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I have developed one web application.
> In that I used aspnet web textBox control.
> I have set maxlength property for that text box 300 and TextMode property
> as multiline .
> When i typed more than 3 or 4 line each line contains 30 to 40 characters,
> If i clicked button for passing textbox value, that time my web page is
> not responsding (no action taken).
> The same page without refereshing if i delete some characters from my
> textbox.
> It is working.
> Can someone help me for this?
> --
> Regards,
> Dhana
>
>
A TextBox in MultiLine mode is rendered as a TextArea HTML control. TextArea
as opposed to an Imput control does not have a maxlength property. It will
be ignored in the TextBox.
There are some 3rd party controls and projects out there that attempt to
control length with javascript for a multiline textbox. I haven't used any
of them so can't comment.
Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org
"Dhana" <dhana@.celtycs-consulting.com> wrote in message
news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I have developed one web application.
> In that I used aspnet web textBox control.
> I have set maxlength property for that text box 300 and TextMode property
> as multiline .
> When i typed more than 3 or 4 line each line contains 30 to 40 characters,
> If i clicked button for passing textbox value, that time my web page is
> not responsding (no action taken).
> The same page without refereshing if i delete some characters from my
> textbox.
> It is working.
> Can someone help me for this?
> --
> Regards,
> Dhana
>
>
Ah yeah...
Try using a javscript function like:
function limitTextarea(textarea, maxlength) {
if (textarea.value.length > maxlength)
textarea.value = textarea.value.substring(0, maxlength);
}
and set the onchange attribute (either programatically with
textbox.attribute.add() or declaratively) on the textbox to call the
function.
"Andrew Robinson" <nemoby@.nospam.nospam> wrote in message
news:%23FQJ$5hDGHA.3820@.TK2MSFTNGP10.phx.gbl...
>A TextBox in MultiLine mode is rendered as a TextArea HTML control.
>TextArea as opposed to an Imput control does not have a maxlength property.
>It will be ignored in the TextBox.
> There are some 3rd party controls and projects out there that attempt to
> control length with javascript for a multiline textbox. I haven't used any
> of them so can't comment.
> --
> Andrew Robinson
> www.binaryocean.com
> www.bellinghamdotnet.org
>
> "Dhana" <dhana@.celtycs-consulting.com> wrote in message
> news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
>

Wednesday, March 28, 2012

Text Box Will Not Wrap Text

VWD 2005 Express. Visual Basic. I placed a text box control on my page. I set the wrap property to true. I assign a value to the text property from code behind. The text does not wrap, but instead disappears when it hits the right margin. The only way I seem to be able to get it to wrap is to set the text box control to "multiline." However, this puts up a scroll bar, which I do not want. I want the box to be single line and to wrap. What might I be doing wrong?

you cant wrap the text unless it's multiline...

You can (I think) remove the scrollbars though, but it will need to be multiline


You need multiline...

What exactly are you trying to do? Have you considered a listbox? How about a dropdownlist box?


Turns out that a label control served me better. Thanks.

Text direction in textbox

Hi guys, is there any property in the textbox control that allows the user to input text in a right-to-left text direction?

Thanks.There is a CSS style attribute calledlayout-flow

In the html header of you page, put the following to control the flow in all form elements (e.g. textboxes included):

<STYLE>
INPUT {layout-flow : vertical-ideographic}
</STYLE>

Text field property

I have a text field i nmy app. If I write "10" in the text field and close the app, then I reload the application and when I focus on the text field I can see all prior entered valued in this text field in a list. I don't like that! How do I prevent this? Is there a property to the textbox which "cleans" the list?i dont know why this would be happening, and im no expert.
i believe it is you own settings in internet explorer

tools
internet options
content
auto complete
:ehh:
This is what I mean:
yes , i believe that is your own setting of internet exploroer.
i.e. if you type in googles search bar, are you greeted with the same drop down list qith ll your previous searches...
Ok, I was not aware of this. Now I have changed the mark in Autocomplete under Forms and everything is ok. But I have to inform all of my users of this :-(
it may be it can be programmed but i am unaware of how,,
perhaps the pragma no cache or something may help,
may be worth a googling if no expert gets back to you here
I don't think this can be changed programmatically. I for one like the feature :D

Saturday, March 24, 2012

Text property values in Textboxes in ASP.NET

I have a website designed where users can enter a large amount of data into a mutlirow textbox. This can be stuff that has line breaks and such. The user can enter this information and it looks OK if I retrieve it from my SQL Database. When I retrieve it into a Windows Forms text box...it looks rather garbled. Is there a way to make them both look the same? I fear that if users muck with the values in my Windows Form support app, it will screw up the display for the web users.

Line breaks on an HTML page can only be achieved by using the <br /> tags, therefore a piece of text with paragraphs will just run together when it is pulled from the DB to the web page. What I do to fix this is I created a function called FormatHTML() that takes a string input and replaces all carriage returns with a "<br />" tag. The function does something like this...
TheString.Replace(CHR(10), "<br />")
You'll need to import Microsoft.VisualBasic to do that.


But the text from the HTML text boxes is not returning HTML tags in the text...actually it appears to be ASCII or something like that. That is what is baffling. To add to my story. I took a text box in Windows Forms on a record that was added from the web. Made complete changes in the multi line text box and saved it. When I re-opened it it looked like it got changed again and had little boxes where line feeds and carriage returns would be and munged it together into a single paragraph.

In SQL Server these text fields are bunched together and where carriage return and linefeeds would be it shows boxes. So if I create these text values in multiline text boxes on the web they look normal like this:
Benefits

This has the following values:

1. Data
2. Data 2
If I open up that value after it has been stored in the database it is all mashed together with boxes for carriage returns and linefeeds. If I edit it in a Windows Forms text box and make it look normal, and then submit that back to the database. The web looks like it does above but going back into the Windows Form text boxes returns it to the funky display. What is up with this??


Nobody??

Text that will appear on a Hyperlink

Hi guys,

Do you know the property on a hyperlink where if the user puts his mouse on the hyperlink, a message will be displayed about that hyperlink. I mean like on this forum, you just hover your mouse pointer on the title of the thread and you will see the message inside. Something like that.

Thanks,

Willy David Jr

ToolTip


Do you mean tooltips?

set it like <a title="tooltips message here" href="http://links.10026.com/?link=http://forums.asp.net/AddPost.aspx?ReplyToPostID=1851390&Quote=False#">LINK</a>


Do you mean tooltips?

set it like <a title="tooltips message here" href="http://links.10026.com/?link=urlhere">LINK</a>


Hi onionpunk,

Thanks for that!

//Willy


For a Hyperlink Button , we have a property called ToolTip where we can give the message that we wish to appear when the mouse is hover on the Hyperlink Button Similarly , if you want to Navigate to the other page when you click the Button , just place the url in Navigate Url property

Tuesday, March 13, 2012

TextBox - MaxLength property

I have a MultiLine TextBox (WebForm - C#) with the MaxLength property = 1000
but am able to type in an unlimited number of characters. Is there a way to
limit the number of characters that can be typed into this TextBox?only the TextBox.TextMode = "singleLine" or "password" , the
TextBox.MaxLength property is valid
so when you set TextBox.TextMode=MutilLine, the MaxLength property not valid
"mg" <mg@.theworld.com> д?
news:46B9FAB4-A15C-4014-AC26-2A99413A67C6@.microsoft.com...
> I have a MultiLine TextBox (WebForm - C#) with the MaxLength property =
1000 but am able to type in an unlimited number of characters. Is there a
way to limit the number of characters that can be typed into this TextBox?

TextBox - MaxLength property

I have a MultiLine TextBox (WebForm - C#) with the MaxLength property = 1000 but am able to type in an unlimited number of characters. Is there a way to limit the number of characters that can be typed into this TextBox?only the TextBox.TextMode = "singleLine" or "password" , the
TextBox.MaxLength property is valid
so when you set TextBox.TextMode=MutilLine, the MaxLength property not valid

"mg" <mg@.theworld.com> д?
news:46B9FAB4-A15C-4014-AC26-2A99413A67C6@.microsoft.com...
> I have a MultiLine TextBox (WebForm - C#) with the MaxLength property =
1000 but am able to type in an unlimited number of characters. Is there a
way to limit the number of characters that can be typed into this TextBox?

TextBox - MaxLength property

I have a MultiLine TextBox (WebForm - C#) with the MaxLength property = 1000 but am able to type in an unlimited number of characters. Is there a way to limit the number of characters that can be typed into this TextBox?only the TextBox.TextMode = "singleLine" or "password" , the
TextBox.MaxLength property is valid
so when you set TextBox.TextMode=MutilLine, the MaxLength property not valid

"mg" <mg@.theworld.com> д?
news:46B9FAB4-A15C-4014-AC26-2A99413A67C6@.microsoft.com...
> I have a MultiLine TextBox (WebForm - C#) with the MaxLength property =
1000 but am able to type in an unlimited number of characters. Is there a
way to limit the number of characters that can be typed into this TextBox?
only the TextBox.TextMode = "singleLine" or "password" , the
TextBox.MaxLength property is valid
so when you set TextBox.TextMode=MutilLine, the MaxLength property not valid

"mg" <mg@.theworld.com> д?
news:46B9FAB4-A15C-4014-AC26-2A99413A67C6@.microsoft.com...
> I have a MultiLine TextBox (WebForm - C#) with the MaxLength property =
1000 but am able to type in an unlimited number of characters. Is there a
way to limit the number of characters that can be typed into this TextBox?

TextBox and Buttons

Hi!

I have a page with a textbox with a OnTextChange property, and two buttons (save and cancel).

In the OnTextChange method I would like to know which button was clicked (save or cancel), and suggestions how to check for that?

- LasseTake a look at a similarpost made couple of days ago
the method-OnTextChange for adding text into the textbox,how can i get the handle of the button,i cant understand your words(ps:sorry for saying this).
may be it can solve by the js

TextBox and Property

Hello,

I am working on Library which will include various controls.

One of these controls has a TextBox.

I am using a property named Value to define the TextBox text:

' Value
Private _Value As String
Public Property Value() As String
Get
Return _Value
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property ' Value

And the TextBox Init event is the following:

Private Sub tbText_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles tbText.Init
tbText.ID = "tbText"
tbText.Text = _Value
End Sub

I added this control to a page and defined its value to "Hello".

I also added a button to the page that when clicked basically does
Response.Write(MyControl.Value)

What happens is that when I change the TextBox text to "Goodbye" and
click the button the text that Response.Write outputs is "Hello".

Why isn't the property returning the new value?

What is the right way to do this?

Thanks,

MiguelHowdy,

This is because you change the text of the text box in the Init event.
Button raises its Click event between Load and PreRender page's events
meaning after you take the value of the Value property. In addition, if the
value is set through the code or data binding its value will be lost because
it's not stored in the viewstate. You need to simplify your code to:

Public Property Value() As String
Get
Return tbText.Text
End Get
Set(ByVal value As String)
tbText.Text = value
End Set
End Property ' Value

Done

hope it helps
--
Milosz

"shapper" wrote:

Quote:

Originally Posted by

Hello,
>
I am working on Library which will include various controls.
>
One of these controls has a TextBox.
>
I am using a property named Value to define the TextBox text:
>
' Value
Private _Value As String
Public Property Value() As String
Get
Return _Value
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property ' Value
>
And the TextBox Init event is the following:
>
Private Sub tbText_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles tbText.Init
tbText.ID = "tbText"
tbText.Text = _Value
End Sub
>
I added this control to a page and defined its value to "Hello".
>
I also added a button to the page that when clicked basically does
Response.Write(MyControl.Value)
>
What happens is that when I change the TextBox text to "Goodbye" and
click the button the text that Response.Write outputs is "Hello".
>
Why isn't the property returning the new value?
>
What is the right way to do this?
>
Thanks,
>
Miguel
>

TextBox and Property

Hello,
I am working on Library which will include various controls.
One of these controls has a TextBox.
I am using a property named Value to define the TextBox text:
' Value
Private _Value As String
Public Property Value() As String
Get
Return _Value
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property ' Value
And the TextBox Init event is the following:
Private Sub tbText_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles tbText.Init
tbText.ID = "tbText"
tbText.Text = _Value
End Sub
I added this control to a page and defined its value to "Hello".
I also added a button to the page that when clicked basically does
Response.Write(MyControl.Value)
What happens is that when I change the TextBox text to "Goodbye" and
click the button the text that Response.Write outputs is "Hello".
Why isn't the property returning the new value?
What is the right way to do this?
Thanks,
MiguelHowdy,
This is because you change the text of the text box in the Init event.
Button raises its Click event between Load and PreRender page's events
meaning after you take the value of the Value property. In addition, if the
value is set through the code or data binding its value will be lost because
it's not stored in the viewstate. You need to simplify your code to:
Public Property Value() As String
Get
Return tbText.Text
End Get
Set(ByVal value As String)
tbText.Text = value
End Set
End Property ' Value
Done
hope it helps
--
Milosz
"shapper" wrote:

> Hello,
> I am working on Library which will include various controls.
> One of these controls has a TextBox.
> I am using a property named Value to define the TextBox text:
> ' Value
> Private _Value As String
> Public Property Value() As String
> Get
> Return _Value
> End Get
> Set(ByVal value As String)
> _Value = value
> End Set
> End Property ' Value
> And the TextBox Init event is the following:
> Private Sub tbText_Init(ByVal sender As Object, ByVal e As
> EventArgs) Handles tbText.Init
> tbText.ID = "tbText"
> tbText.Text = _Value
> End Sub
> I added this control to a page and defined its value to "Hello".
> I also added a button to the page that when clicked basically does
> Response.Write(MyControl.Value)
> What happens is that when I change the TextBox text to "Goodbye" and
> click the button the text that Response.Write outputs is "Hello".
> Why isn't the property returning the new value?
> What is the right way to do this?
> Thanks,
> Miguel
>

TextBox and Property

Hello,

I am working on Library which will include various controls.

One of these controls has a TextBox.

I am using a property named Value to define the TextBox text:

' ValuePrivate _ValueAs String Public Property Value()As String Get Return _ValueEnd Get Set(ByVal valueAs String) _Value = valueEnd Set End Property' Value

And the TextBox Init event is the following:

Private Sub tbText_Init(ByVal senderAs Object,ByVal eAs EventArgs)Handles tbText.Init tbText.ID ="tbText" tbText.Text = _ValueEnd Sub

I added this control to a page and defined its value to "Hello".

I also added a button to the page that when clicked basically does Response.Write(MyControl.Value)

What happens is that when I change the TextBox text to "Goodbye" and click the button the text that Response.Write outputs is "Hello".

Why isn't the property returning the new value?

What is the right way to do this?

Thanks,

Miguel

You have to use ViewState. means you have to save your property value in the ViewState, so that when page postbacks all the values are retrived from viewstate.

Public Property Value()As String
Get
Return ViewState["Value"]
End Get
Set(ByVal valueAs String)
ViewState["Value"] = value
End Set
End Property' Value

I hope this will resolve your problem.
Let me know in case of any further queries


So I will not need the variable _Value in this case?

And is this the only way to do this?

Thanks,

Miguel


Hello,

I also tried the following:

Private _ValueAs String Public Property Value()As String Get Return tbText.TextEnd Get Set(ByVal valueAs String) _Value = valueEnd Set End Property' Value

This works. How?

Should I use this way or the ViewState?

Thanks,

Miguel


No, you can directly save your values in ViewState.
I don't think there may be any other way, because whenever your form is posted on server all the values are stored in ViewState.

I hope it would help!


shapper:

Hello,

I also tried the following:

Private _ValueAs String Public Property Value()As String Get Return tbText.TextEnd Get Set(ByVal valueAs String) _Value = valueEnd Set End Property' Value

This works. How?

Should I use this way or the ViewState?

Thanks,

Miguel

Yes because Textbox.Text is stored in ViewState


Just one more question. When using the code you suggested:

Private _ValueAs String Public Property Value()As String Get Return ViewState("Value")End Get Set(ByVal valueAs String) ViewState("Value") = valueEnd Set End Property' Value

How should I know define the initial value of my textbox?

In this moment I have:

MyTextBox.Text = _Value

Of course I could use

MyTextBox.Text =Me.Value
However, sometime ago, also in Microsoft forum there was a thread that I started weather in the code should I use ... = Me.PropertyName or ... = _PropertyName
It seems most people use the variable _PropertyName.
How should I do it?
I suppose using  
MyTextBox.Text = ViewState("Value")
isn't a very nice way to do it.
Anyway, just looking for a standard way (or the closest to it) to do this.
Thanks,
Miguel 


Hi ,

THis problem is due to IsPostBack property. when you intially assigned the value Hello value check the property

If Not Page.IsPostBack Then

assign your assign intial value to control...

TextBox1.Text = "sample value"

End If


Public Property Value() As String
Get
Dim viewState As Object = ViewState("Value")

If viewState Is Nothing Then
' Return your default value here instead of an empty string
Return String.Empty
Else
Return CStr(viewState)
End If
End Get
Set(ByVal value As String)
ViewState["Value"] = value
End Set
End Property

NC...