Submit in User Control

  • Thread starter Thread starter Sara T.
  • Start date Start date
S

Sara T.

If I have one page aspx that is using two same user control, how can I know
in page load event of aspx that which id of user control is submit ?
 
You get the SubmitControl ID in the Request.form
Collection - if you have two usercontrols with ids UC1
and UC2 and in both there is a button PbSubmit, and you
press PbSubmit in Uc2, request.form["UC2:PbSubmit"]
exists and
request.form["UC1:PbSubmit"] doesn`t exists. So you could
write in PageLoad:

if (!IsPostback)
{
if (request.form["UC2:PbSubmit"]!=null)
{ Uc2 submitted}
if (request.form["UC1:PbSubmit"]!=null)
{ Uc1 submitted}
}
 
Almost done.
But below routine is for checking there is user control in form or not but I
need to check that which submit button is pressed from user control.
 
Back
Top