Ascx to Ascx Method Call

  • Thread starter Thread starter Sylvie
  • Start date Start date
S

Sylvie

I have a webform and two userwebcontrol on this webform

Webform.aspx

Grid.ascx

Form.ascx (it has a public method ShowDetail() )

I wanna do that, when user clicks on a grid row, form.asmx 's sehowdetail()
method must be called in order to refresh itself

How can I reach an asmx method from another ascx code part ?

Thanks
 
Sylvie said:
I have a webform and two userwebcontrol on this webform

Webform.aspx

Grid.ascx

Form.ascx (it has a public method ShowDetail() )

I wanna do that, when user clicks on a grid row, form.asmx 's
sehowdetail() method must be called in order to refresh itself

How can I reach an asmx method from another ascx code part ?

An elegant way to do it would be to create and expose a public event
inside grid.ascx, which you would fire whenever you got a click on a row.
Then, in your Webform.aspx, you would hook that event and call ShowDetail()
in Form.ascx.
This lets you maintain each ascx completely "encapsulated", without
introducing a dependency from one ascx into the other, and you let the
connection to be established in the form that contains both controls, which
is the one place that "knows" about both.
 
Sylvie said:
I have a webform and two userwebcontrol on this webform

Webform.aspx

Grid.ascx

Form.ascx (it has a public method ShowDetail() )

I wanna do that, when user clicks on a grid row, form.asmx 's
sehowdetail() method must be called in order to refresh itself

How can I reach an asmx method from another ascx code part ?

Thanks

Create an event in the Grid user control and raise it when the click event
is handled. Handle the user controls event in the page and call the
appropriate method in the Form user control. This is just one way to do it,
there are others :)

HTH,
Mythran
 
Back
Top