Greetings,

I am developing a backend website using ASP.NET. I had a 3 GridView controls within the page. I am using the jQuery to add a CSS class to third column of the 3 GridViews when the page in ready as I tried to add this class by setting the CssClass property of the column and it did not work. The problem is that I used an UpdatePanel to ensure a partial post back, however, when I used such panel when the page post back the class of the third column I add through jQuery is lost and the column returned to its normal shape (i.e., normal CheckBox). I googled and I tried too many solution but none of them worked. I added the script again within the <contenttemplate> tag, I add the method name within the jQuery to the OnClientClick of the button that update the GridView content, I registered a script using the C# code within the Page_Load event

ClientScriptManager script = Page.ClientScript;
        script.RegisterClientScriptBlock(script.GetType(), "PostBack", "MyScript", true);

However, none of the three methods worked for me can anyone help. In addition I need to call a C# code from within script, however, too many people saying put the code within <%= and %> pair but when doing this and debugging I found that all of my code does not exist within the script block!!!!

Greetings,

I got the solution and it works for me. I put the Sys.WebForms.PageRequestManager.getInstance().add_endRequest with my script function as a parameter within my contenttemplate inside the update panel. However, it did not work for my first design so I had to change it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.