Click here to Skip to main content
15,890,370 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
.cs

C#
protected void  form_submit_Click(object sender, EventArgs e)
    {
        String str = "$('.txt').style.border-style=none;";
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "chp", str.ToString(), true);
    }

.aspx

ASP.NET
<asp:TextBox ID="txtname" runat="server" BorderColor="#96A6C5" CssClass="txt">
Posted
Updated 21-Sep-12 7:07am
v2
Comments
Sergey Alexandrovich Kryukov 21-Sep-12 13:09pm    
Your str.ToStrings() shows that you don't know the very basic. I would not advise you to go in for ASP.NET before you make yourself comfortable in very elementary programming techniques.
--SA
Sandeep Mewara 21-Sep-12 13:50pm    
I doubt if this is a valid attribute of style: border-style

I don't think your jQuery string is correct. Try this:

C#
String str = "$('.txt').css('border-style', 'none');";


On another matter, SA is correct: you don't need to and shouldn't .ToString() a string.
 
Share this answer
 
I would advise to use the scripts:
C#
$(.txt).addClass("withBorder");
// and
$(.txt).removeClass("withBorder");


Your ".txt" CSS class should be without the borders, and the class "withBorder" (should be named like that, without '.'), should define some border. This way, you can switch between bordered and non-bordered style leaving the rest of styles the same, using the JavaScript lines shown above.

Please see:
http://api.jquery.com/category/css/[^].

The problem could by somewhere else. For example, the selector ".txt" should be in quotation marks and the class with such names should exist in styles you are using. Do you have this class? There could be something else — your sample is incomplete.

Please see:
http://api.jquery.com/class-selector/[^].

And pay attention for my comment to the question, if you want to avoid frustration and lost time.

—SA
 
Share this answer
 

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

  Print Answers RSS


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