How to change the border of the asp:textbox, on click of the textbox? [Resolved]

Posted by Iluvdotnetfunda under ASP.NET on 4/20/2012 | Points: 10 | Views : 3011 | Status : [Member] | Replies : 8
Hello Friends,

How to change the border of the asp:textbox, on click of the textbox?
Please anyone help me for this?
This is my textbox

 <asp:TextBox ID="txtFName" runat="server" MaxLength="30"  />
<asp:RequiredFieldValidator ID="req1" ErrorMessage="Please Provide FirstName" ForeColor="Red" runat="server"
ControlToValidate="txtFName"></asp:RequiredFieldValidator>



Thanks
iluvdotnetfunda




Responses

Posted by: Iluvdotnetfunda on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down

Resolved
Hi friends,

Thanks for your help, this issue as been solved by CSS style.

Thanks
iluvdotnetfunda

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: GSM_GSV on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
sorry for the wrong code...

Include this javascript

<script type ="text/javascript">


function ChangeBorder(obj, evt)
{
if(evt.type=="focus")
obj.style.borderColor="red";
else if(evt.type=="blur")
obj.style.borderColor="black";
}
</script>


Markup
<asp:TextBox ID="txtFName" runat="server" onfocus ="ChangeBorder(this,

event)" onblur ="ChangeBorder(this, event)"></asp:TextBox>



---------------------------------------
Live the life you've dreamed

Regards
MADHU

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
http://www.codeproject.com/Questions/95669/How-to-change-Textbox-BorderColor-in-C

____________
www.flickr.com/photos/psdesigner/

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
@GSM_GSV

_TextBoxClick is not a valid event.

____________
www.flickr.com/photos/psdesigner/

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Iluvdotnetfunda on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
I think this can be achieved by CSS style ...
Let me know

Thanks

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
100% Working code. Using Jquery

<div id="content">

<asp:TextBox id="txtUser" runat="server" ></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>


$( "#content" ).delegate( "*", "focus blur", function( event ) {

var elem = $( this );
setTimeout(function() {
elem.toggleClass( "focused", elem.is( ":focus" ) );
}, 0);
});



____________
www.flickr.com/photos/psdesigner/

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Campusrecruitment on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
SEO and SEM are basically the same, SEO is optimizing pages for the search engines and SEM is marketing the pages for the search engines. The same goes for SMM and SMO just with social media sites instead of normal sites and search engines. That's as basic as I can put it lol.

http://www.campusrecruitments.com/Bank/bankpapers.html


[url=http://www.campusrecruitments.com/Bank/bankpapers.html]Bank Exams Papers[/url]

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 4/20/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
hi Campusrecruitment

This is a first warning , if i find you again posting this kind of message in the forum i will ban you from the site. i will remove this message.

Thank you for posting at Dotnetfunda
[Administrator]

Iluvdotnetfunda, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response