Results 1 to 3 of 3
  1. #1
    manik's Avatar
    manik is online now Om Shanti!
    Join Date
    Apr 2008
    Location
    Boston, USA
    Posts
    13,172
    Thanks
    744
    Thanked 699 Times in 550 Posts
    Blog Entries
    4
    Feedback Score
    4 (100%)

    Default Find the control that raised postback event on a page

    Using this method you may find the control that raised the PostBack event on a page.

    Code in C#:

    public static Control GetPostBackControl(Page page)
    {
    Control control = null;
    string ctrlname = page.Request.Params.Get("__EVENTTARGET");
    if (ctrlname != null && ctrlname != string.Empty)
    {
    control = page.FindControl(ctrlname);
    }
    else
    {
    foreach (string ctl in page.Request.Form)
    {
    if ((ctl.LastIndexOf(".x") > 0) || (ctl.LastIndexOf(".y") > 0))
    {
    control = page.FindControl(ctl.Substring(0, ctl.Length - 2));
    break;
    }
    /*control = page.FindControl(ctl);
    if ((control is System.Web.UI.WebControls.Button))
    {
    break;
    }*/

    }
    }
    return control;
    }
    Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK


  2. #2
    Join Date
    Apr 2008
    Location
    USA, New York -- Born in India
    Posts
    4,811
    Thanks
    510
    Thanked 202 Times in 160 Posts
    Feedback Score
    4 (100%)

    Default

    Manik, sorry for being n00bish but what is PostBack?
    Amir Mullick, SEO and Internet Marketer.
    Wanna learn more about SEO? Visit my SEO Blog and Gadgets Blog

  3. #3
    manik's Avatar
    manik is online now Om Shanti!
    Join Date
    Apr 2008
    Location
    Boston, USA
    Posts
    13,172
    Thanks
    744
    Thanked 699 Times in 550 Posts
    Blog Entries
    4
    Feedback Score
    4 (100%)

    Default

    Quote Originally Posted by Amirmullick3 View Post
    Manik, sorry for being n00bish but what is PostBack?
    Thats a ASP .Net term. When you click on a asp .net control(buttons etc) on a web page very asp .net it could cause a PostBack which will communicate with the server.
    Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK


  4. The Following User Says Thank You to manik For This Useful Post:

    Amirmullick3 (12-10-2008)

Similar Threads

  1. Great Article:How to get indexed faster
    By krates98 in forum Directories
    Replies: 29
    Last Post: 04-30-2012, 09:25 AM
  2. Free Search Engine Submission Links
    By Nazia in forum All Other Search Engines
    Replies: 28
    Last Post: 01-31-2012, 02:50 AM
  3. All You Need To Know About SEO
    By articleenterprise in forum Search Engine Optimization
    Replies: 19
    Last Post: 04-13-2009, 02:14 AM
  4. Page Load Sequence with Masterpage
    By manik in forum ASP
    Replies: 2
    Last Post: 01-16-2009, 01:24 PM
  5. Replies: 1
    Last Post: 12-17-2008, 07:04 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •