How can i determine which dropdownlist caused the postback on Page Load event ?

Hi Experts ,

Is there any method or property that will tell which drop-down list causes the postback property on ASP.NET web form
karthik80cAsked:
Who is Participating?
 
Lokesh B RConnect With a Mentor DeveloperCommented:
Hi,

You can get the control which caused postback as below.

 
 
protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Control c = null;

                string controlName = Page.Request.Params.Get("__EVENTTARGET");

                if (!String.IsNullOrEmpty(ctrlName))
                {
                    c = page.FindControl(ctrlName);
                }

            }
        }

Open in new window

1
All Courses

From novice to tech pro — start learning today.