Submit in User Control

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 ?
 
M

mike

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}
}
 
S

Sara T.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top