Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

user control prob

  Asked By: Jaxson    Date: Sep 01    Category: Asp.net    Views: 686
  

i wasnt clear so i am asking again:
i have aspx page with user control inside it's form.
the control has button that do postback
i want to activate a function in the control only when the submit in the aspx
page is fired.
if i will activate the function in the control page.isPostBack it will fire also
when the control button is clicked.
in other words - in the control code behind :
if page.isPostBack then

'want to know if the post back came from the aspx or from the button in the
control

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Laurel Collins     Answered On: Sep 01

Why don't you just call control's public method from aspx  page in
SubmitButton_Click even handler? Make a public method in the control's class and
call it.

 
Answer #2    Answered By: Orville Rodriguez     Answered On: Sep 01

yes.i can do that , but i prefer that the function  will activate
automatically when the submit is clicked.

 
Answer #3    Answered By: Bonifaco Garcia     Answered On: Sep 01

try making a delegate and an event on the page  and make a handler in the
control. I don't know it that would work, but it could. Normaly it's
vice-a-versa but maybe the other way arround could also work.

BTW. Method would be called automaticly if you do the way I said before. In any
way you'd have to call an event handler... Nothing happens automaticly. there's
always the code  to tell it what to do. But if you do it the ways I just said
(event on a page) you don't have to take care of the controls on the page. You
just take care that you make a handler in the control. And page "automaticly"
calls delegates...

 
Answer #4    Answered By: Estella Mitchell     Answered On: Sep 01

when i do :


If Page.IsPostBack Then

Response.Write("ggg")

End If

in the aspx  page ,it's write also "ggg" when the button inside  the user
control is fired...

i want it to be written only when the submit in aspx eas clicked

 
Answer #5    Answered By: Felicia Hill     Answered On: Sep 01

ok.
i put it in
SubmitButton_Click even handler
and it's working ok.

 
Didn't find what you were looking for? Find more on user control prob Or get search suggestion and latest updates.




Tagged: