RE: Please help with handling events in a tabstrip/multipage/user
From: Ashok (Ashok_at_discussions.microsoft.com)
Date: 12/01/04
- Next message: Viksi: "RE: TableCell style problem PLEASE HELP"
- Previous message: Jay: "TableCell style problem PLEASE HELP"
- In reply to: Ashok: "RE: Please help with handling events in a tabstrip/multipage/user cont"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 1 Dec 2004 11:17:03 -0800
Hi Aron,
I forgot to mention few more things. Please read below too.
See in .aspx you have changed the name of the form. If you change the "name"
or "id" attribute of the .aspx file
for Example in .aspx file if you changed from
<form id="Form2" method="post" runat="server">
to
<form id="Wizard_InstallDeviceToAIMS_Disp_AssetsList" method="post"
runat="server">
then all the designer related events will be lost and you have to recreate
them in the
private void InitializeComponent()
{
}
of your multipage form.
This is another reason why your events don't fire in the multipage view
controls.
Thanks
Ashok Thota
"Ashok" wrote:
> Hi Aaron,
>
> I don't know whether you solved this problem already or not. Here is how i
> resolved it.
>
> In the code behind keep the Multipage control declaration as the last one
>
> protected Microsoft.Web.UI.WebControls.MultiPage WizardSteps;
>
> In .aspx make sure that have your Multipage control related html info is
> inside the start and ending tag of "form"
>
> <form Id="TestForm>
>
>
> ==> All multipage related controls html data
>
>
> </form> ending tag
>
> Hope it works for you.
>
> Ashok
>
> "Aaron" wrote:
>
> > I cannot get an event to fire within my multipage/usercontrol environment.
> >
> > I have been reading O'Reilly's "Programming ASP.NET 2nd Edition" and found
> > some information regarding handling events in user controls. Here is what I
> > have done...
> >
> >
> > I have dragged a button to my user control, SearchFields, and added a
> > handler:
> > Private Sub btnSubmitSearchPrefs_Click(ByVal sender As System.Object,
> > ByVal e As System.EventArgs) Handles btnSubmitSearchPrefs.Click
> > RaiseEvent ButtonClick(sender, e)
> > End Sub
> >
> > I have also added the event in the class definition of my user control:
> > Public Event ButtonClick(ByVal sender As Object, ByVal e As EventArgs)
> >
> > In the aspx file, I have added a withevents clause for the usercontrol:
> > Protected WithEvents SearchFields As SearchFields
> >
> > I also added a handler in the aspx file for the event which SHOULD be raised
> > from the UC:
> > Sub SaveSearchFieldsBtnClickEvent(ByVal sender As Object, ByVal e As
> > EventArgs)Handles SearchFields.ButtonClick 'Searchfields is the UC and
> > ButtonClick is the event in the UC
> > MessageBox.MessageBox.MsgBox("Click")
> > End Sub
> >
> > So everything looks wired up correctly. (but must not be)
> > When the UC's btnSubmitSearchPrefs is clicked, it should raise an event,
> > ButtonClick, which should be handled on the aspx code-behind with the Sub,
> > SaveSearchFieldsBtnClickEvent.
> >
> > I am still unable to hit the breakpoint.
> >
> > Some additional information:
> > When I load the application for debugging here is what happens.
> > I click on the preferences tab which shows my pageview correctly. There is
> > nothing but a label and a dropdown list. When I select "Search" from the
> > dd, the page_load event fires from the user control. Here is that code:
> >
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > 'Put user code to initialize the page here
> > End Sub
> >
> > Then, after that sub finishes, PrefConfigSelect is called from the
> > code-behind of my aspx page. Here is that code:
> >
> > Private Sub PrefConfigSelect(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles ddSelectPrefArea.SelectedIndexChanged
> > Dim DDSelection As String
> > DDSelection = ddSelectPrefArea.SelectedItem.Value.ToString
> > 'Check which dropdown selection was made and act accordingly
> > Select Case DDSelection
> > Case "Search"
> > Dim SFP As SearchFields = LoadControl("SearchFields.ascx")
> > pnlSearchPrefs.Controls.Add(SFP)
> > Case "Entry"
> > MessageBox.MessageBox.MsgBox("Entry")
> > Case "Edit"
> > MessageBox.MessageBox.MsgBox("Edit")
> > Case "Jobs"
> > MessageBox.MessageBox.MsgBox("Jobs")
> > Case "Companies"
> > MessageBox.MessageBox.MsgBox("Companies")
> > Case "Schedule"
> > MessageBox.MessageBox.MsgBox("Schedule")
> > Case "Research"
> > MessageBox.MessageBox.MsgBox("Research")
> > Case "Reports"
> > MessageBox.MessageBox.MsgBox("Reports")
> > End Select
> >
> > End Sub
> > The user control is added to the panel and I see the checkboxes and submit
> > button.
> >
> > When I click the submit button, a postback appears to occur, but no
> > messagebox is displayed and I cannot hit the breakpoint.
> >
> > Why can I not hit the breakpoint I have set on the UC at
> > btnSubmitSearchPrefs_Click?
> > Does anyone handle events from their user controls and if so, am I going
> > about this correctly?
> >
> > I would very much appreciate any advice or insight.
> >
> > Thank you,
> > Aaron
> >
> >
> >
- Next message: Viksi: "RE: TableCell style problem PLEASE HELP"
- Previous message: Jay: "TableCell style problem PLEASE HELP"
- In reply to: Ashok: "RE: Please help with handling events in a tabstrip/multipage/user cont"
- Messages sorted by: [ date ] [ thread ]