Click here to Skip to main content
13,352,631 members (38,891 online)
Rate this:
Please Sign up or sign in to vote.

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);


<asp:TextBox ID="txtname" runat="server" BorderColor="#96A6C5" CssClass="txt">
Posted 21-Sep-12 8:06am
Updated 21-Sep-12 8:07am
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.
Sandeep Mewara 21-Sep-12 13:50pm
I doubt if this is a valid attribute of style: border-style
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

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

On another matter, SA is correct: you don't need to and shouldn't .ToString() a string.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I would advise to use the scripts:
// and

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:[^].

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:[^].

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


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100