PDA

Click to See Complete Forum and Search --> : VS 2010 [RESOLVED] Pretty Username Box


spyk3
Dec 27th, 2010, 10:31 AM
ok, been awhile since i messed with ASP.Net and i forgot way to much.
Anyway, suffice it to say, i have the coding and know how in a basic csharp of vb app to set the username box to have a slightly off colored text inside it that shows "[username]", but i cant seem to get this same function in asp page
i've devided off my login to a master page with a view, blah blah blah, and set all of my controls in my view, but for the life of me cannot figure out how to get the nice looking message boxes. Well, I say nice looking, but it's just personal opinion. I think it looks nicer to have simple text boxes with offcolored text telling you what goes in them rather than the big bulky label out to the side.
Of course I also need the functionality of clearing the text after the box is clicked on. sure there is java for that somewhere, but i think that would have to be set in my controller code? i dunno, its been awhile.
but in the end, i want message boxes with clearable text that say stuff like [username] in some off (not normal textbox color as user types) color
any ideas?

gep13
Dec 27th, 2010, 01:03 PM
Hey,

Are you using the ASP.Net Login control, or are you creating a "Login Control" of your own?

At the end of the day, you can style pretty much every control, however you want it, using CSS, but in order to help you do that, we are going to need to know exactly what you are using.

Can you perhaps show some of the code that you are using?

Gary

spyk3
Dec 27th, 2010, 01:18 PM
asp login control with asp textboxes, i tried thier preset ones, but they were ugly and used tables ... bleh! so i redid one similar on my own useing div boxes and "fluid design" so the screen size doesn't matter

gep13
Dec 27th, 2010, 01:25 PM
Hey,

Have you thought about using the friendly CSS Control Adapters:

http://www.asp.net/cssadapters/membership/login.aspx

They might be able to give you what you want.

Gary

spyk3
Dec 27th, 2010, 01:36 PM
nah, that was what i was talkin about when i said they're ugly. Since this login form is completely custom, the top part of that table "Login" is redundant, the labels are useless for whats wanted.
What's wanted is for the username text box to actually have a text value of [username] and then for that text value to clear upon clicking it
i think i got the clear part down, its the giving it focus and possibly even changing the font of the text that i'm having trouble with
I know it's possible because i've seen it on other pages
in previous software i've writtin, it was easy to do due to the event codes. I just simply set the form load event to establish the look and text of text in the username box, then on box click i change it, that simple! but asp.net through an mvc application does not seem to be so easy. I've found some code on how to change it from a page, but that would mean my master page would have those boxes hardcoded in, which it doesn't. The customer wants fluid flexability, thus the use of content p[lace holders, however, what i can actually manipulate in the view associated with such place holders appears to be limited or have limited information. All i can find is where people are changing the main pages, but again, this defeats my purpose. I mean, afterall, what's the use of a content placeholder, if you cant use it to make things modular? and you can, thus my use in this manner, however, finding documentation on how to change a modular login page seems to be near impossible. As I said before, i don't want my master login page edited, it has it's basics; background, head banner, div slots for key picture framing, and content placeholders (which leads to the master content and login content areas)

quick text writtin example
I goto login page
I see 2 textboxes, the upper box has a grey text that says [username]
I click on it, the text clears and i enter username, which shows up nice and bold and black, easy to read
then type in password, check remember me box and log btn! mission accomplished!

spyk3
Dec 27th, 2010, 01:46 PM
this attachment is a pic of something like what i got going
cept the [username] part needs to be greyed out and the textbox doesn't get focus on load, which again, i can only find code and info on how to do this from masterpage or a simple independent page, but that defeats my purpose of placing the login textboxes in contentplaceholders that are adjusted from the view, not from the master page.

gep13
Dec 27th, 2010, 01:52 PM
but asp.net through an mvc application does not seem to be so easy.

Hold on, are you using ASP.Net MVC?

That is something completely different.

Gary

spyk3
Dec 27th, 2010, 01:54 PM
from what i've read on it, it appeared to be the best use for what i needed to do, it actually has made things really easy. i already got the majority of the site application done, it's jus tthis stupid login page bending to the clients "wants"

spyk3
Dec 27th, 2010, 03:35 PM
in mvc, suffice it too say, i havn't quite fully figured out how to work the inbetween vb class that is ment to incorporate the .net part to all this. it's not like the other web apps i did a long while back, at least i dont think it is, cause those all had events for the page already listed in the class, but these classes seem to be completely eventless, thus i havn't ussed em for much except for some data loading during the get view action

gep13
Dec 29th, 2010, 12:40 PM
Hey,

The MVC paradigm is very different to ASP.Net Web Forms applications, and everything that has been suggested to date isn't really applicable (apart from CSS).

I am going to move your question over to the MVC forum, as I think people there will be able to help you more.

Gary

spyk3
Dec 29th, 2010, 12:58 PM
10-4, its kinda new too me, at least as far as asp.net using mvc

jmcilhinney
Jan 2nd, 2011, 09:43 AM
There's nothing all that special here. You simply set the value and style of your text box to initially display the prompt and then use JavaScript to change the value and style when it receives focus.

jmcilhinney
Jan 2nd, 2011, 10:00 AM
<script type="text/javascript">
function hideUserNamePrompt()
{
var field = document.getElementById("userName");
var text = field.value;

if (text == "[username]")
{
field.value = "";
field.style.color = "Black";
}
}

function showUserNamePrompt()
{
var field = document.getElementById("userName");
var text = field.value;

if (text == "")
{
field.value = "[username]";
field.style.color = "Gray";
}
}
</script>

<input id="userName" name="userName" onblur="showUserNamePrompt()" onfocus="hideUserNamePrompt()" style="color:Gray" type="text" value="[username]" />

Serge
Jan 18th, 2011, 11:51 AM
After working with ASP.NET MVC, I will never use classic ASP.NET WebForms ever again :) MVC is the way to go :)

spyk3
Jan 18th, 2011, 12:12 PM
lol, never mind, i figured it out a while back and then we shifted to php which made it even easier
now if only ms would support php and stop trying to make their own webstandards

Serge
Jan 18th, 2011, 12:40 PM
Why would MS support PHP (btw, they do in form of FastCGI for IIS) :)

jmcilhinney
Jan 18th, 2011, 05:16 PM
After working with ASP.NET MVC, I will never use classic ASP.NET WebForms ever again :) MVC is the way to go :)

Can ah get a Amen?!

gep13
Jan 19th, 2011, 01:27 AM
Can ah get a Amen?!

:) I am still yet to be convinced by it.

I have only toyed with MVC, I haven't had to use it in anger. Will need to wait for a full project where I can use it before I make an opinion.

Gary

spyk3
Jan 19th, 2011, 11:05 AM
eh, it's alright and great to use with .net library, but since everything is moving to the web, ie still needs better php support and mvc could stand to incorporate jquery without use of plugins, after all, linux systems and everything else in the world aren't bowing to ms, ms is just being snobby not playing with everyone else nicly. it's annoying that as a coder these days i have to learn 7 different languages just to get one fully cross compatible web application with a possible downlaod user side console. it's absolute bs. but whatever. for software on a pc alone, i'll use .net, but for web apps, php is still stronger and been around much longer.

jmcilhinney
Jan 19th, 2011, 06:05 PM
eh, it's alright and great to use with .net library, but since everything is moving to the web, ie still needs better php support and mvc could stand to incorporate jquery without use of plugins, after all, linux systems and everything else in the world aren't bowing to ms, ms is just being snobby not playing with everyone else nicly. it's annoying that as a coder these days i have to learn 7 different languages just to get one fully cross compatible web application with a possible downlaod user side console. it's absolute bs. but whatever. for software on a pc alone, i'll use .net, but for web apps, php is still stronger and been around much longer.

You can run PHP on IIS and you can run other web servers on Windows, so I don't really see the issue there. As for MVC, it is still quite new but improving rapidly. The improvements since v1 are significant, including seamless integration of jQuery and jQuery UI in MVC3.

I haven't done any non-MS web development besides basic HTML so I can't really compare there, but I never did like using Web Forms so MVC is a great improvement over that. I guess ASP.NET MVC is the best of both worlds, i.e. more like what you would do on other platforms but with all the strengths of Microsoft development tools.

spyk3
Jan 19th, 2011, 07:43 PM
well mvc is only a new concept to ms, but many don't seem to realize that it has been in java/php for a long minute. get code ignitor and komodo and be good to go. but my only issue with ms is that, while it is quite powerful, they refuse to truly mesh with php and continue to aim towards silverlight as a standard. however, until consumer hardware standards improve, you still get better preformance and similar quality using the older language of php. I love ms products, dont get me wrong. I just feel, as a coder of both ms and linux based items, it seems ms is fighting a losing battle in trying to force their standards across the interwebs. If anything, it could be of better use making .net software more coopertive and friendly with the existing "standard" (more than half of all sights on internet are php based). For instance, I would love to be able to quickly make use of a clients .net liabrary from a php web app and simply be able to make use of existing hardware for better movement throughout a site with more bells and whistles. As it stands, the 2 dont play well, and while iis might support php, its not pretty (no where near as simple as a xampp setup). MS's .Net is a powerhouse PC-wise and can create very powerful, very useful, downloadable only Software, but in the same respect, for web applications and web sites, PHP's jQuery lib is just as powerful for the interwebs stuff, thus making it the better tool for web shared software (including networking, as terminal calls of ms are still way outdated and networking with security is just a joke). I love both, but have quickly realize that asp.net mvc is nothing more than ms's attempt to catch asp.net up to where php has been for years. and asp.net wasn't so great to start. in the end, i love .net, but it doesn't belong on my interwebs and IE needs to start playing nice. I mean, yeah, the hardware accelerator is great, but i still cant use half the sites i come across because of how they fight javascript and css updates, it's beyond annoying.

gep13
Jan 20th, 2011, 04:32 PM
I don't think anyone would argue that the MVC pattern has been around for a long time. ASP.Net MVC is just Microsofts implementation of it.

I don't seem the synergy between PHP and Silverlight. They are two completely different things?!?

Gary

spyk3
Jan 21st, 2011, 08:48 AM
which is half of my point, and silverlight is just, eh, ms is better off with their base os', .net library and xna. all other web stuff should be left to php at this point and silverlight is pretty, makes good pc based proggys. but silverlight doesn't belong on the internet yet. standard of hardware for what 90% of the world has is just not up to par to handle silverlight. I can make the exact same sight in php and silverlight and asp.net, and i guarantee the php one will load faster all day long. boo hoo, the php page cant play video games other than flash, thats where silverlight and xna can shine and is the only place ms needs to be on the internet. I love MS, but not on it's net savy junk. Even their networking sux. Not that Cisco is any better (unless you can afford their high end solutions). The internet is a different monster that just doesn't belong in MS' hands, which is what they really want to do and think because they created the first web browser they should, but they really shouldn't and that web browser hasn't really been used by anyone since netscrape was invented. The new one is alright, but still falls short on almost 40% of the sights online, as it doesn't play well with php and css standards.

gep13
Jan 22nd, 2011, 03:11 PM
I don't think this needs to turn into a flame war between MS and PHP. At the end of the day, people have their own preferences.

Gary

spyk3
Jan 22nd, 2011, 03:15 PM
lol, to true
tho i am a little upset, for real, about MS's lack of integration with already existing web standards.
Namely cause I really love using and programming in MS product enviroments, but at the end of the day, everything i need web wise just isn't covered by MS (everything including support for small 1 to 5 person teams, time consumption, web standards, keeping in mind the basic "behindness" of users, etc...)

gep13
Jan 22nd, 2011, 03:20 PM
Ok, so let's break this down...

support for small 1 to 5 person teams
- What exactly are you referring to? Visual Studio? Source Control?

time consumption
- Not sure what you mean by this?

web standards
- At the end of the say, it is up to the user to decide what web standards they want to meet. For instance, the DOCTYPE in an ASP.Net Web Form allows you to indicate which standard to are attempting to meet.

keeping in mind the basic "behindness" of users
- What exactly is your point here?

Gary

spyk3
Jan 22nd, 2011, 03:31 PM
Visual Studio for web development is "Too powerful" for small persons dev team on inet apps. U really only need a simple notepad/html editor and maybe a php studio of some sort (i tend to go komodo with code ignitor support)
Not that power is not great, but the extra cost and time spent working it all through in class setups and template designs (that take little if any time in komodo) is not worth the effort or money of a small dev team

time consumption is simple, anything you can do in an asp.net app i can do in a php app in half the time it takes you to do it

web standards are not user defined, at the end of the day, its compitition
Most users are too "ignorant" (in literal since) to know what they want, thus companies like MS fight with other standard companies to define a standard, however, before MS tried to overhaul things for themselves, several standards had already been put in place and they refuse to acknoledge them ill they reach a last minute decision and realize they have too. For example, almost any website i want to view that isn't specifically designed for IE, I can view with mostly the same effects on ALL OTHER BROWSER PLATFORMS except IE which will constantly find java it doesn't like or php, or css or whatever.
Take it from a css coder for ... well since css existed, ie is the most unpleasant in dealing with simple design, they're webkit is constantly requiring its own calls and bs

the behindedness, is just that, most users are behind, period. they aren't carying the technical hardware MS seems to think everyone should have as soon as it's available. People are poor, and get what they can afford, aside from the ignorance which makes for even more behindedness.

it's really that simple. if you want a good, quick, web site/app solution for a small team, use php and a few of the thousand available tools as well as a largly supported community with more info than the msdn library.
If you want a powerhouse production, have a large team, and can afford the microsoft tax, go with MS production software.

just that simple

gep13
Jan 22nd, 2011, 03:42 PM
I would have to disagree with that. Even in small dev teams, you have to have some structure in your code. Integration with Code Analysis, TFS, Work Item Managemnt, all adds to the ability of a dev team to thrive.

That is a bold claim :)

I think everyone would agree that in the early years, MS tried to enforce their own way of doing things, implementing functionality that only works in IE, however, I think you will find that this is no longer the case. MS are pushing the HTML 5 standard, and their target is to fully support this, this is evident in the IE 9 Beta.

If you are talking specifically about Silverlight here, I don't see what technical hardware you are referring to. As you mention, a simple Silverlight Application, doesn't require much to run at all.

Have you seen WebMatrix? This is specifically designed to allow you to create quick and simple web applications, if you don't want to use full Visual Studio. There is also a thriving community within Microsoft, with any knowlegdable users ready to help you, as well as loads of sample applications and videos to help you get up and running.

At the end of the day, it sounds like you are very much focused on PHP, and that is fine. However, I have to argue with some of the points that you are making as, personally, I feel that it is very simple to get up and running with Microsoft Web Development. Perhaps starting with WebMatrix, then onto Visual Web Developer Express, and perhaps Expression Blend, and then, if you need to, onto a full Visual Studio instance.

Gary

sapator
Jan 24th, 2011, 07:52 PM
I have to say that what is best is judged from the usage of the product commercially.So even if a product is super and it doesn't get commercial use then it's a "bad" product.So i will let you think this:How many sites use php and aspx? Now, how many sites use MVC? How many sites uses Flash?Now how many sites use silverlight?Actually i do want to know the last one.Is there a serious site that uses silverlight except Microsoft sites?

spyk3
Jan 25th, 2011, 10:00 AM
http://trends.builtwith.com/framework/PHP 34.68%
http://trends.builtwith.com/framework/ASP.NET 23.18%
also if u notice, ms trends are dropping while php is rising
nuff said

I'll continue to use MS to make powerhouse clientside only software, and everything else for anything web/network based

sapator
Jan 25th, 2011, 06:25 PM
The general idea was php and asp combined VS MVC or any other halfbreed.
Use whatever you like.