5 Replies - 954 Views - Last Post: 26 July 2018 - 07:28 AM Rate Topic: -----

#1 gkrishnat   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-July 18

Retrieving Control Name on the postback

Posted 25 July 2018 - 11:26 AM

Hi There,

I have a form and on that there is a tab control. Each tab control has server button for Add, Update.

My query here is on clicking of Add or Update button there will postback so I need to catch the control id or name to identify which button has raised the postback event.



Thanks & Regards,

Gopi Thakur
Is This A Good Question/Topic? 0
  • +

Replies To: Retrieving Control Name on the postback

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14691
  • View blog
  • Posts: 58,705
  • Joined: 12-June 08

Re: Retrieving Control Name on the postback

Posted 25 July 2018 - 12:01 PM

What are you using? Webforms? Razor pages? MVC?
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is offline

  • dependency injected
  • member icon

Reputation: 6668
  • View blog
  • Posts: 27,306
  • Joined: 12-December 12

Re: Retrieving Control Name on the postback

Posted 25 July 2018 - 12:36 PM

Odd. Shouldn't Add or Update trigger distinct 'actions'? Control names should not enter the equation.
Was This Post Helpful? 0
  • +
  • -

#4 gkrishnat   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-July 18

Re: Retrieving Control Name on the postback

Posted 25 July 2018 - 10:18 PM

View Postmodi123_1, on 25 July 2018 - 12:01 PM, said:

What are you using? Webforms? Razor pages? MVC?


I am using ASP.NET WebForm. It is .aspx page.
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw   User is offline

  • dependency injected
  • member icon

Reputation: 6668
  • View blog
  • Posts: 27,306
  • Joined: 12-December 12

Re: Retrieving Control Name on the postback

Posted 26 July 2018 - 01:20 AM

I know nothing of the older ASP.NET / WebForms but a search suggests a solution to getting the control name:

On postback, how can I check which control cause postback in Page_Init event
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14691
  • View blog
  • Posts: 58,705
  • Joined: 12-June 08

Re: Retrieving Control Name on the postback

Posted 26 July 2018 - 07:28 AM

Double click on the form designer's button. It should auto create the method to catch the specific postback from the button. It's super similar to winforms.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1