Click here to Skip to main content
15,914,444 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends.....

I am using this JQuery.
JavaScript
$(document).ready(function () {
           $("#btn_Add").click(function () {
               $("#TextBox2").css({ "background-color": "yellow", "font-size": "200%" });
               $("#TextBox1").css('visibility', 'hidden');

           });
       });

And ASP.net Control.
ASP.NET
<asp:Button ID="btn_Add" runat="server" Text="Add Records" />
 <asp:TextBox ID="TextBox1" runat="server">
 <asp:TextBox ID="TextBox2" runat="server">

But I press Button(btn_Add) some secound apply after refesh and as useally control display..
use this asp.net.

Please Fast reply me.
Posted
Updated 16-Apr-13 19:38pm
v2
Comments
Rockstar_ 17-Apr-13 1:32am    
not clear dear?
can u plz elaborate ur problem?

Why using so complicated way? Just use the methods .hide() and .show():
http://www.w3schools.com/jquery/jquery_hide_show.asp[^].

—SA
 
Share this answer
 
Comments
Abhai Oza 17-Apr-13 1:36am    
I know first i have check but use in asp.net not possible and page reload time as it as display after few second not minits.
Sergey Alexandrovich Kryukov 17-Apr-13 1:38am    
Not clear what are you trying to say. This is a correct working solution.
—SA
Abhai Oza 17-Apr-13 1:40am    
No...This Eg.use in asp.net after tell me.
Not working.
Sergey Alexandrovich Kryukov 17-Apr-13 1:43am    
Why do you think it works for me? Anything special, in your case?
—SA
Manfred Rudolf Bihy 17-Apr-13 1:49am    
OP is using the wrong ID. It's the server side ID and not the client side ID.
I showed him how to get the correct ID in my solution. :)
First of all I'd go along with SA's solution of using show() and hide() to achieve your goal. The next problem is that you are using the wrong ID. ID's of ASP.net tags with runat="server" are what identifies the tag on the server side. When that tag gets rendered by ASP.net and output to the client (browser) the id attribute will be a different one. The good thing is you can find out what exactly the client id attribute is by using this code:

NTML
$(document).ready(function () {
    $("#btn_Add").click(function () {
        $("#<%=TextBox2.ClientID %>").css({ "background-color": "yellow", "font-size": "200%" });
        $("#<%=TextBox1.ClientID %>").css('visibility', 'hidden');

    });
});


Regards,

— Manfred
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 17-Apr-13 1:51am    
Good catch! 5ed.
—SA
Abhai Oza 17-Apr-13 1:52am    
Give me any one example..?
Manfred Rudolf Bihy 17-Apr-13 2:12am    
The example is in the modification of your code snippet in my solution : <%= TextBox1.ClientID %>.
Have you tried it out yet?
Here it is :

JavaScript
$(document).ready(function () {
   $("#btn_Add").click(function () {
     $("#TextBox2").css({ "background-color": "yellow", "font-size": "200%" });
     $("#TextBox1").css('display', 'none');
     //or you can try this
     $('#TextBox1').toggle();
  });
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900