Click here to Skip to main content
16,018,318 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to after all event like textbox change or button click
i want to check any button is enable false or true

for this
C#
#region "Button CSS"
    public void clear(ControlCollection col)
    {
        foreach (System.Web.UI.Control item in col)
        {
            if (item == null)
            {
                return;
            }
            if (item.HasControls())
            {
                clear(item.Controls);

            }
            else if (item is System.Web.UI.WebControls.Button)
            {

                if (((System.Web.UI.WebControls.Button)(item)).Enabled == true)
                {
                    ((System.Web.UI.WebControls.Button)(item)).CssClass = "buttonDefault";
                }
                else if (((System.Web.UI.WebControls.Button)(item)).Enabled == false)
                {
                    ((System.Web.UI.WebControls.Button)(item)).CssClass = "buttonDisable";
                }
            }

        }
    }
    #endregion


but call this method for all WebForms
I want to
C#
clear(Page.Controls);


Call this method after Application_EndRequest
in global asax file
How to do that or any other solutions

if button Enable true i have set CSS for that and False another CSS
Posted

see some hint

Global.asax in ASP.NET[^]
 
Share this answer
 
v2
Create a static function in Global.asax and access it using global_asax.function()
 
Share this answer
 
Comments
Member-515487 20-Dec-12 23:23pm    
can u explain and how means shold i call this fuction global_asax.function() to all event ?

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