Showing posts with label boxes. Show all posts
Showing posts with label boxes. Show all posts

Saturday, March 31, 2012

Text Box Background Yellow at Runtime?

Folks,

I have a few text boxes that the backgrounds are set to white and appear white in the Visual Studio development widow. At runtime they appear as a brownish yellow.

What gives?

SethYou're viewing them on a Windows XP system.

Jeff
You might want to check this out:


Yellow textboxes

Text box Display

I don't understand the Display setting for controls such as text boxes.
I have a text box a button next to it, and then a submit button below
everything so that when the 1st button is pressed, a calendar appears
underneath it.

Becasue the submit button is below all the user input stuff, I want to
make it so that the calendar and the submit buttons are given set
positions on the screen, so that whenever I press the 1st button, my
submit button doesn't get pushed down the screen to make way for the
calendar.

I would've thought Display="Static" would do this, but I get the same
result as using Display="Dynamic". Can anybody help me out with this?

Any help would be really appreciated.

Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!You need to use absolute display but make sure the parent elements are all
setup - positioning elements in pixel offsets is not a very good thing to
do. Static is meant for something else and IE does not even support it.

Jerry

"Mike P" <mrp@.telcoelectronics.co.uk> wrote in message
news:OVZiJ#UmDHA.2772@.TK2MSFTNGP10.phx.gbl...
> I don't understand the Display setting for controls such as text boxes.
> I have a text box a button next to it, and then a submit button below
> everything so that when the 1st button is pressed, a calendar appears
> underneath it.
> Becasue the submit button is below all the user input stuff, I want to
> make it so that the calendar and the submit buttons are given set
> positions on the screen, so that whenever I press the 1st button, my
> submit button doesn't get pushed down the screen to make way for the
> calendar.
> I would've thought Display="Static" would do this, but I get the same
> result as using Display="Dynamic". Can anybody help me out with this?
>
> Any help would be really appreciated.
>
> Thanks,
> Mike
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

text box text wont change

i have a asp.net page that has some text boxes with some text in there..then i have a submit button..the problem is that when i try in code to get what the textboxes have in the .Text property i get what i've put when the page loaded and not what actually the user has written! anyone has experienced this? what am i doing wrong? :confused:

help!!!!!!!!!!!!!You just not checking for post back...like I said in the other thread, post your code (especially your load event code) and I will show you how to use it properly to ensure things like this don't happen.
load event
WebMessage web = Serializer.BinDeSerializer(Server.MapPath(@."Logs\" + Request.QueryString["File"]));
msgTxt.Text = web.Message;
titleTxt.Text = web.Title;
nickTxt.Text = web.Author;
post(edit)button
case "EDIT": {
Debug.WriteLine(titleTxt.Text);
string filename = Server.MapPath(@."Logs\" + Request.QueryString["File"]);
WebMessage oldMsg = Serializer.BinDeSerializer(filename);

if (File.Exists(filename)) {
File.Delete(filename);
}

WebMessage newMsg = new WebMessage(
titleTxt.Text,
msgTxt.Text,
nickTxt.Text,
DateTime.Now,
oldMsg.Comments,
Path.GetFileName(filename));

Serializer.BinSerialize(newMsg, filename);
Response.Redirect("Log.aspx?&Action=POST", true);
break;
where titleTxt,msgTxt,nickTxt are the TextBoxes which arent changing the text
In your page load event, check for Page.IsPostBack.

if (!Page.IsPostBack) {
// Perform your initialization (db calls, etc..)
}
still not working...i dont get what would help checkin if it is postback or not lol..because if it is postback and now is not working then checking for it wont help, if it isnt and isnt working by checking i will not do it work..so *** can i do?
Because we are working in a stateless environment. Everytime a postback occurs, the page_load event fires off before any of the control event(s) that caused the post back. So, if you reset the values in the load event, then in your event handler, you are still dealing with the initial default values.
Change to this:

if (!Page.IsPostBack)
{
WebMessage web = Serializer.BinDeSerializer(Server.MapPath(@."Logs\" + Request.QueryString["File"]));
msgTxt.Text = web.Message;
titleTxt.Text = web.Title;
nickTxt.Text = web.Author;
}
hmm...even with hellswraith code it doesnt work..
Well, the code I posted is the exact same, so it wouldn't work (minus the three lines of code) :rolleyes:

Post your entire code-behind, it's something else..
hmm my page is getting a bit confusing, since its only my 2nd asp.net project and i wasnt expecting for somethings i had to implement..i will make a new architecture for the site and then i will try again and if it doesnt work post it here again..but i need to implement cookies..anyone could answer by other post about cookies plz? :D

tks by ur answers btw

Text Box to change on focus... Possible?

Hi i was just wondering if it was possible to change a text boxes default value onFocus... I have a search bar and rather then put next to it search product here I wanted to have written in the text box as default Enter Product Code.. and then when the box is clicked on it clears this text away and has a blank textbox before they begin to type

Thanks in advance for any help given

Hey,

Yes, there are two ways to do it. There is a TextboxWatermarkExtender (in the AJAXControlToolkit), which renders the text and manages that automatically for you, or you can use manual javascript, simply by catching the focus and when the textbox value is equal to the watermark value, clear it. I don't have an example on-hand, but you should be able to find one.


Create a test ASPX and add following:


<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Text="Enter Here"></asp:TextBox> <br/>
</div>
</form>
<script language="javascript" type="text/javascript">
function ClearValue()
{
document.getElementById("<%=TextBox1.ClientID %>").value = "";
}
</script>


In Code Behind add following:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Attributes.Add("OnFocus", "javascript:ClearValue();")
End Sub

Hope this will serve the purpose.


Code for the text box:

<input id="txtBox1" type="text" value="Some Default Value" onfocus="ClearTxt();" />

Javascript function to clear default value:

<script type="text/javascript">
function ClearTxt() {
document.getElementById("txtBox1").value = ""
}
</script>


you could use a javascript method like teh one shown here

http://www.urban75.org/tech/q024.html


Thanks alot guys for all the help


try this

tst.Attributes.Add("onFocus","ctrl = document.getElementById('tst');ctrl.value = '';")

replace both occurrences of tst with the name of the textbox


Hi sorry i know this is an old post but I was wondering, I managed to get this working the only little thing is if I click in the box it deletes the text (what I was looking for) but if I dont type anything and click away from the box it's still blank.. I was wondering if there was a way to refill the text box with the default text again

Thanks


Hey,

Attach to the client onblur event, that if the textbox's text length is zero, put the text back in the textbox.


I know I am a strong anti-Javascript developer, but using javascript to set properties of a form control is not a very good idea, especially if you consider accessibility issues. Rather, why not to attach labels to the text box, and/or use tool-tip feature for displaying user information. This is both, dynamic, on focus, as well as Accessible to challanged users.

Again, it is kind of personal opinion, but then you have to think about the accessibility issues at some point of time!

Wednesday, March 28, 2012

Text Box with yellow background?

Some of the text boxes on my form are being displayed with a yellow backgound, even though the yellow boxes are coded the same as the boxes appearing with a white background. Any ideas what is causing this annoying behaviour?

Thanks....Franco

Its a by product of your Google toolbar, not ASP.NET :}

DOH!


Thanks Curt. You are absolutely right. I wouldn't have thought of that in a thousand years!

Franco

Text Boxes

Hello,

I built my first little project in asp.net and I'm not very advanced yet. The program I wrote is to balance a simple checkbook. If you wish to see it its at http://www.l3roken.com/checkbook.aspx. I wanted to know a little about text boxes. First I wante to be able to format the how the text shows up so it would only allow a dollar sign and 2 decimal places. Secondly I wanted to be able to pass an integer within the text boxes instead of using the .text object. If anyone could point me to some good tutorials on what I'm trying to accomplish I would appreciate it.

JoshHello, I recommend that you check the following links:

-TextBox
-TextBox Control
-TextBox Class

Regards.
Hi,

textboxes only accept text so if you want it to be of type integer you'll have to cast it to the type you need.

In C# this could be something like: int myNum = (int)TextBox1.Text

Grz, Kris.

Text boxes in web pages

Am I the only person in the world or are there others that experience this problem.

When programming a web page, I create a table with text boxes in it. The background color of the boxes change to a yellow colr when the app is run.

I have even tried resetting the color in code but it still changes to yellow.

This has happened in several versions of VB .net that I have used.

Any solutions would be greatly appretiated as I have tried all that I know.

PeterGThread Moved
It's not ASP.NET - it's the Google toolbar, or any other autocomplete toolbar, you have installed.
Yes, that is true. I just learned of this in another thread a few hours ago thanks to timeshifter.

Uninstall the google toolbar.

text boxes appearing differently

I am trying to create a simple user control for a person's name, It will ask for first name, middle name, last name, and suffix.
For some reason the text box associated with suffix is appearing with a background of while while all the others have a background of yellow. The properties are all the same for each of the boxes.
I have determined this is due to my google bar. Any idea what I can do to ensure consistency without removing the google bar?
<code>
<html>


First Name:You must enter a first name for the provider
Middle Name:
Last Name:You must enter a last name for the provider
Suffix: (e.g. Jr. , M.D. , etc.)

</html>
</code>

Yep, here ya go:
http://code.jenseng.com/google/

Text boxes and read-only text

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 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'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.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 change, why wont you text change!

Hi i've got a huge form with loadsa recordsets that populate text boxes, AND I MEAN LOADS!!!!
It involves some calculations
I have text1.text which goes away and changes text2.text which is fine, but in text2.text i have another on text change thingy which it wont call :(
any one have any ideas : )
also does any one know how i could call a txt change, so it does the call total a. dont know if thats possible as well.

PrivateSub txtShare_TextChanged(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles txtShare.TextChanged

Call Total_A()

EndSub
Thank you if any one one could help i'd really appreciate it

does this help?

http://www.mredkj.com/vbnet/textboxtextchangedpostback.html


hi just had a look at it,

Hvn't tried it yet, dont think it will do it but i could be wrong hope it works, thanks for the reply
Really appreciate it cheers mate/lass
If any one else has an idea just give us a post dont be scared, go onnnnn
Damb!!! that didnt work, heres my problem again in english - i was a bit tired when i posted it orignally.
I have loadsa text boxes and when i change one it works and it will load the page again and display the new value and run what ever is in the textbox change command.
However when that text box changes there is another text box that also has a text change function applied to it which it needs to call however that doesnt seem to be running its function becuase it thinks the text hasnt change becuase i didnt set it a focus but on the page postback it did change the text grrrr

textbox1 looks like this

PrivateSub txtOwned_TextChanged(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles txtOwned.TextChanged

Call Total_A() 'this goes away and does some sums and updates other text boxes and also changes text2 - code below

EndSub


and text2box looks like this



If txtCaution_b.Text = "0"Then

lblcaution.Text = "Loaded Land Balances"

lblcaution.ForeColor = Color.Black

Else

lblcaution.Text = "Loaded Land Does Not Balance"

lblcaution.ForeColor = Color.Red

EndIf
in vb this would work damb u asp.net DAMB YOUUUUU!!!!


i feel like kicking my self i think it will work but i have to change the js to what ever the textbox is to text1.text rather than using the passing parameter. cheers bud u *
:)

Of course there is no "text" property accessible from Javascript... do you mean "value"?