Solved

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

Posted on 2016-11-17
1
43 Views
Last Modified: 2016-11-17
Hi Experts ,

Is there any method or property that will tell which drop-down list causes the postback property on ASP.NET web form
0
Comment
Question by:karthik80c
1 Comment
 
LVL 14

Accepted Solution

by:
Lokesh B R earned 500 total points
ID: 41891363
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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question