Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i have event handler i want to invoke that one.but not possible to me.
Bellow is my Code in my ASCX File......

C#
public delegate void PersonHandler(object sender,EventArgs e);
public event PersonHandler CountrySelectedIndexChange;
public event PersonHandler StateSelectedIndexChange;
public event PersonHandler btnUploadClick;
public event PersonHandler btnSubmitClick;

protected virtual void rcbCountryName_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (this.CountrySelectedIndexChange != null)
        {
            this.CountrySelectedIndexChange(sender, e);
        }
    }
    protected void rcbStateName_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (this.StateSelectedIndexChange != null)
        {
            this.StateSelectedIndexChange(this,e);
        }
    }

********

when i execute the above code i am getting null value from CountrySelectedIndexChange and it did not enter into if Loop......
So please any one help me..


Thanks
Posted
Updated 19-Oct-12 20:28pm
v3
Comments
Sandeep Mewara 19-Oct-12 10:35am    
Incomplete question. You have not shared, how you invoked it.

My guess is (your code is incomplete) that you are falling foul of the page life cycle here. Everything is destroyed when the page is rendered to the browser. This will include any event subscriptions you make when the page is first displayed to the user.

When the page is re-created following a response from the browser you need to make sure the events are re-subscribed to before the click event is raised. This is because on post-back a new instance of the page is created and filled with information from the response, amongst other things.
 
Share this answer
 
Comments
Balakrishna2 20-Oct-12 1:07am    
Hi,
At the time of page load i am doing postBack.Please suggest me how to write code.
Actually i am using Web user Control inside the RadGrid.i want to update/insert records using Web user Controls.So please help me.In my user controls i have following controls:
1) RadTextBox for personName
2) RadComboBox for Country,state,city,
3) RadAsyUploader for uploading image,
4) RadBinaryImage for image.
So please help me.........
then tell me how to write code.
please help me
 
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