Ask a Question related to ASP.NET General, Design and Development.
-
S. Justin Gengo #1
Re: Bubbling Event ---- Problem!!!!
Mackarand,
Is the user control being reloaded on post back?
I'm doing exactly what you describe on my own web site. When I decided to go
this route the first thing I found was that I needed to reload the control
into its placeholder for for the event to fire.
I hope this helps.
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"Makarand" <mkeer@celpro.com> wrote in message
news:053601c34dda$1d4c6120$a601280a@phx.gbl...> Hi
> I am having ASP.NET user control in which I have ASP.NET
> DataGrid Control. To this dataGrid Control I am
> dynamically adding controls using 'Dynamic addition of
> ItemTemplate'. Now I want to send the event that is raised
> by the control which is added dynamically to the consumer
> of my 'ASP.NET user control'. For that I intend to use
> Event Bubbling. But It is not working in my case.
>
> I am using RaiseBubbleEvent method in ItemTemplate class
> to send the event to parent control and OnBubbleEvent
> method to catch the Events in my UserControl, but I dopn't
> get the events in UserControl
>
> Can any one help me?
>
> Thanx in advanced
> Makarand
S. Justin Gengo Guest
-
Event Bubbling Custom Object not inheriting from control
One of the new things flash flex and xaml have are ways which the event easily bubbles up to a parent that knows how to handle the event. Similar... -
Event Bubbling From The HeaderTemplate
I have three LinkButtons in the HeaderTemplate of my DataList (I use them to let the user determine what to sort the list by). I am assuming that... -
Event Bubbling
Dear Folks, I have some issue with bubbling the event above two levels in the hierarch I have a web custom control 'B' . 'B' consists of a button... -
Bubbling Event in Composite controls
Hi Everyone, I am building a composite server control. I have defined an event for my child control with Custom Event Arguments. I am using the... -
Event Bubbling from a template
Hi, I have a template in a DataList. The template also contains a DataList. I'd like to bubble the OnItemCommand event from the template's... -
Makarand #2
Re: Bubbling Event ---- Problem!!!!
Hello Justin
I could not understand exactly what you are saying.
Have you solved this problem in your project? if yes could
you please give me the code files in which you have used
bubbling of events from Child controls.
Thanx in advanced.
BTW I am Makarand and not Mackarand :)
Regards
Makarand
When I decided to go>-----Original Message-----
>Mackarand,
>
>Is the user control being reloaded on post back?
>
>I'm doing exactly what you describe on my own web site.reload the control>this route the first thing I found was that I needed toraised>into its placeholder for for the event to fire.
>
>I hope this helps.
>
>--
>S. Justin Gengo, MCP
>Web Developer
>
>Free code library at:
>[url]www.aboutfortunate.com[/url]
>
>"Out of chaos comes order."
> Nietzche
>"Makarand" <mkeer@celpro.com> wrote in message
>news:053601c34dda$1d4c6120$a601280a@phx.gbl...>> Hi
>> I am having ASP.NET user control in which I have ASP.NET
>> DataGrid Control. To this dataGrid Control I am
>> dynamically adding controls using 'Dynamic addition of
>> ItemTemplate'. Now I want to send the event that isconsumer>> by the control which is added dynamically to thedopn't>> of my 'ASP.NET user control'. For that I intend to use
>> Event Bubbling. But It is not working in my case.
>>
>> I am using RaiseBubbleEvent method in ItemTemplate class
>> to send the event to parent control and OnBubbleEvent
>> method to catch the Events in my UserControl, but I>>> get the events in UserControl
>>
>> Can any one help me?
>>
>> Thanx in advanced
>> Makarand
>
>.
>Makarand Guest
-
S. Justin Gengo #3
Re: Bubbling Event ---- Problem!!!!
Makarand,
Sorry about the typo in your name!
Yes, I've solved this problem.
Here is some sample code:
'In the page load event I use the following code to determine if a control
should be reloaded:
If Page.IsPostBack Then
'---Post back only
If CType(ViewState("ReloadControl"), String) > "" Then
Dim ControlToLoad As String = ViewState("ReloadControl").ToString
plchldrContent.Controls.Add(LoadControl(ControlToL oad))
End If
End If
'---The following code is used to get the event bubbled up from a control to
the default page. (The events I'm showing here all load new controls onto
the page.)
Protected Overrides Function OnBubbleEvent(ByVal source As Object, ByVal
args As System.EventArgs) As Boolean
Try
Select Case (source.GetType.ToString)
Case "System.Web.UI.WebControls.Button"
Dim mobjButton As Button
mobjButton = CType(source, System.Web.UI.WebControls.Button)
Select Case mobjButton.ID
Case "BiographyButton"
Call MenuButtonClicked("pages/Biography.ascx", False)
End Select
Case "System.Web.UI.WebControls.LinkButton"
Dim mobjButton As LinkButton
mobjButton = CType(source, System.Web.UI.WebControls.LinkButton)
Select Case mobjButton.ID
Case "FavoritesLinkButton"
Call MenuButtonClicked("pages/favorites.ascx", True)
End Select
End Select
Catch ex As Exception
Call ProcessError("There was a menu button error:", ex)
End Try
End Function
'---When a button that loads a different control into the page is clicked
this function loads the control
Private Sub MenuButtonClicked(ByVal ControlToLoad As String, ByVal
ReloadControl As Boolean)
Try
If Not CType(ViewState("ReloadControl"), String) = ControlToLoad Then
plchldrContent.Controls.Clear()
plchldrContent.Controls.Add(LoadControl(ControlToL oad))
Call SetControlReload(ControlToLoad, ReloadControl)
End If
Catch ex As Exception
Throw ExceptionCaught
End Try
End Sub
'---If the control has objects with events that will be bubbled up to the
default page it needs to be reloaded.
Private Sub SetControlReload(ByVal controlToLoad As String, ByVal
reloadControl As Boolean)
Try
If reloadControl Then
ViewState("ReloadControl") = controlToLoad.ToString
Else
ViewState("ReloadControl") = Nothing
End If
Catch ex As Exception
Throw ex
End Try
End Sub
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"Makarand" <mkeer@celpro.com> wrote in message
news:033701c34f3d$f63b0bd0$a501280a@phx.gbl...> Hello Justin
>
> I could not understand exactly what you are saying.
> Have you solved this problem in your project? if yes could
> you please give me the code files in which you have used
> bubbling of events from Child controls.
>
> Thanx in advanced.
> BTW I am Makarand and not Mackarand :)
>
> Regards
> Makarand
>> When I decided to go> >-----Original Message-----
> >Mackarand,
> >
> >Is the user control being reloaded on post back?
> >
> >I'm doing exactly what you describe on my own web site.> reload the control> >this route the first thing I found was that I needed to> raised> >into its placeholder for for the event to fire.
> >
> >I hope this helps.
> >
> >--
> >S. Justin Gengo, MCP
> >Web Developer
> >
> >Free code library at:
> >[url]www.aboutfortunate.com[/url]
> >
> >"Out of chaos comes order."
> > Nietzche
> >"Makarand" <mkeer@celpro.com> wrote in message
> >news:053601c34dda$1d4c6120$a601280a@phx.gbl...> >> Hi
> >> I am having ASP.NET user control in which I have ASP.NET
> >> DataGrid Control. To this dataGrid Control I am
> >> dynamically adding controls using 'Dynamic addition of
> >> ItemTemplate'. Now I want to send the event that is> consumer> >> by the control which is added dynamically to the> dopn't> >> of my 'ASP.NET user control'. For that I intend to use
> >> Event Bubbling. But It is not working in my case.
> >>
> >> I am using RaiseBubbleEvent method in ItemTemplate class
> >> to send the event to parent control and OnBubbleEvent
> >> method to catch the Events in my UserControl, but I> >> >> get the events in UserControl
> >>
> >> Can any one help me?
> >>
> >> Thanx in advanced
> >> Makarand
> >
> >.
> >
S. Justin Gengo Guest
-
Makarand #4
Re: Bubbling Event ---- Problem!!!!
Thanx Friend.
determine if a control>-----Original Message-----
>Makarand,
>
>Sorry about the typo in your name!
>
>Yes, I've solved this problem.
>
>Here is some sample code:
>
>'In the page load event I use the following code to("ReloadControl").ToString>should be reloaded:
>
>If Page.IsPostBack Then
> '---Post back only
>
> If CType(ViewState("ReloadControl"), String) > "" Then
>
> Dim ControlToLoad As String = ViewState(ControlToLoad))>
> plchldrContent.Controls.Add(LoadControlup from a control to>
> End If
>
>End If
>
>
>
>'---The following code is used to get the event bubblednew controls onto>the default page. (The events I'm showing here all loadAs Object, ByVal>the page.)
>
>Protected Overrides Function OnBubbleEvent(ByVal sourceSystem.Web.UI.WebControls.Button)>args As System.EventArgs) As Boolean
>
>Try
>
> Select Case (source.GetType.ToString)
>
> Case "System.Web.UI.WebControls.Button"
>
> Dim mobjButton As Button
>
> mobjButton = CType(source,("pages/Biography.ascx", False)>
> Select Case mobjButton.ID
>
> Case "BiographyButton"
>
> Call MenuButtonClickedSystem.Web.UI.WebControls.LinkButton)>
> End Select
>
> Case "System.Web.UI.WebControls.LinkButton"
>
> Dim mobjButton As LinkButton
>
> mobjButton = CType(source,("pages/favorites.ascx", True)>
> Select Case mobjButton.ID
>
> Case "FavoritesLinkButton"
>
> Call MenuButtonClickedex)>
> End Select
>
> End Select
>
>Catch ex As Exception
>
> Call ProcessError("There was a menu button error:",page is clicked>
>End Try
>
>End Function
>
>
>
>'---When a button that loads a different control into theString, ByVal>this function loads the control
>Private Sub MenuButtonClicked(ByVal ControlToLoad AsControlToLoad Then>ReloadControl As Boolean)
>
>Try
>
> If Not CType(ViewState("ReloadControl"), String) =(ControlToLoad))>
> plchldrContent.Controls.Clear()
>
> plchldrContent.Controls.Add(LoadControlReloadControl)>
> Call SetControlReload(ControlToLoad,bubbled up to the>
> End If
>
>Catch ex As Exception
>
> Throw ExceptionCaught
>
>End Try
>
>End Sub
>
>
>
>'---If the control has objects with events that will beString, ByVal>default page it needs to be reloaded.
>
>Private Sub SetControlReload(ByVal controlToLoad AscontrolToLoad.ToString>reloadControl As Boolean)
>
>Try
>
> If reloadControl Then
>
> ViewState("ReloadControl") =could>
> Else
>
> ViewState("ReloadControl") = Nothing
>
> End If
>
>Catch ex As Exception
>
> Throw ex
>
>End Try
>
>End Sub
>
>
>--
>S. Justin Gengo, MCP
>Web Developer
>
>Free code library at:
>[url]www.aboutfortunate.com[/url]
>
>"Out of chaos comes order."
> Nietzche
>"Makarand" <mkeer@celpro.com> wrote in message
>news:033701c34f3d$f63b0bd0$a501280a@phx.gbl...>> Hello Justin
>>
>> I could not understand exactly what you are saying.
>> Have you solved this problem in your project? if yesASP.NET>> you please give me the code files in which you have used
>> bubbling of events from Child controls.
>>
>> Thanx in advanced.
>> BTW I am Makarand and not Mackarand :)
>>
>> Regards
>> Makarand
>>>> When I decided to go>> >-----Original Message-----
>> >Mackarand,
>> >
>> >Is the user control being reloaded on post back?
>> >
>> >I'm doing exactly what you describe on my own web site.>> reload the control>> >this route the first thing I found was that I needed to>> >into its placeholder for for the event to fire.
>> >
>> >I hope this helps.
>> >
>> >--
>> >S. Justin Gengo, MCP
>> >Web Developer
>> >
>> >Free code library at:
>> >[url]www.aboutfortunate.com[/url]
>> >
>> >"Out of chaos comes order."
>> > Nietzche
>> >"Makarand" <mkeer@celpro.com> wrote in message
>> >news:053601c34dda$1d4c6120$a601280a@phx.gbl...
>> >> Hi
>> >> I am having ASP.NET user control in which I haveof>> >> DataGrid Control. To this dataGrid Control I am
>> >> dynamically adding controls using 'Dynamic additionuse>> raised>> >> ItemTemplate'. Now I want to send the event that is>> consumer>> >> by the control which is added dynamically to the>> >> of my 'ASP.NET user control'. For that I intend toclass>> >> Event Bubbling. But It is not working in my case.
>> >>
>> >> I am using RaiseBubbleEvent method in ItemTemplate>>> dopn't>> >> to send the event to parent control and OnBubbleEvent
>> >> method to catch the Events in my UserControl, but I>> >> get the events in UserControl
>> >>
>> >> Can any one help me?
>> >>
>> >> Thanx in advanced
>> >> Makarand
>> >
>> >
>> >.
>> >
>
>.
>Makarand Guest



Reply With Quote

