473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

User control event problem

I have a grid and a user control on the same page. The user control has a
save button that triggers a click event server side. Once the click event
happens the page renders, but I need to update the grid information before
it renders. Once a conrol's event finishes is there a way to run a method
on the parent page so I can update the gid? Any thoughs on how I might
accomplish this?
Nov 19 '05 #1
6 1368
Page.MethodName()

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.

"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I have a grid and a user control on the same page. The user control has a
save button that triggers a click event server side. Once the click event
happens the page renders, but I need to update the grid information before
it renders. Once a conrol's event finishes is there a way to run a method
on the parent page so I can update the gid? Any thoughs on how I might
accomplish this?

Nov 19 '05 #2
Rob,

If you want the event to run on the main page only when that button is
clicked you may find out when a button is clicked by overriding the
OnBubbleEvent on the main page like this:

1.. Protected Overrides Function OnBubbleEvent(ByVal source As Object,
ByVal args As System.EventArgs) As Boolean
2.. Try
3.. Select Case (source.GetType.ToString)
4.. Case "System.Web.UI.WebControls.Button"
5.. Dim Button As Button
6..
7.. Button = CType(source, System.Web.UI.WebControls.Button)
8..
9.. Select Case Button.ID
10.. Case "SubmitButton"
11.. '---Call any code you want here: with access to the control's
viewstate.
12..
13.. Case "CancelButton"
14.. End Select
15.. Case "System.Web.UI.WebControls.LinkButton"
16.. Dim LinkButton As LinkButton
17..
18.. LinkButton = CType(source, System.Web.UI.WebControls.LinkButton)
19..
20.. Select Case LinkButton.ID
21.. Case "HomeLinkButton", "SortLinkButton"
22.. End Select
23.. End Select
24.. Catch ex As Exception
25.. '---Process Exception
26.. End Try
27.. End Function

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I have a grid and a user control on the same page. The user control has a
save button that triggers a click event server side. Once the click event
happens the page renders, but I need to update the grid information before
it renders. Once a conrol's event finishes is there a way to run a method
on the parent page so I can update the gid? Any thoughs on how I might
accomplish this?

Nov 19 '05 #3
My methods don't seem to be in Page or am I mising something simple?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:#e**************@TK2MSFTNGP09.phx.gbl...
Page.MethodName()

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Complex things are made up of
Lots of simple things.

"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I have a grid and a user control on the same page. The user control has a save button that triggers a click event server side. Once the click event happens the page renders, but I need to update the grid information before it renders. Once a conrol's event finishes is there a way to run a method on the parent page so I can update the gid? Any thoughs on how I might
accomplish this?


Nov 19 '05 #4
Thanks for the example.... My example was a bit simplified because I'm
dynamically loading the controls and the controls could have anything within
them. The last thing the control should after it runs any events is to tell
the page to update itself so it can show the last modifications from the
controls event. The best wqy, that I know, is to have every control call a
standard method from the parent page that pulls the latest data and then
render.

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:ul**************@TK2MSFTNGP09.phx.gbl...
Rob,

If you want the event to run on the main page only when that button is
clicked you may find out when a button is clicked by overriding the
OnBubbleEvent on the main page like this:

1.. Protected Overrides Function OnBubbleEvent(ByVal source As Object,
ByVal args As System.EventArgs) As Boolean
2.. Try
3.. Select Case (source.GetType.ToString)
4.. Case "System.Web.UI.WebControls.Button"
5.. Dim Button As Button
6..
7.. Button = CType(source, System.Web.UI.WebControls.Button)
8..
9.. Select Case Button.ID
10.. Case "SubmitButton"
11.. '---Call any code you want here: with access to the control's
viewstate.
12..
13.. Case "CancelButton"
14.. End Select
15.. Case "System.Web.UI.WebControls.LinkButton"
16.. Dim LinkButton As LinkButton
17..
18.. LinkButton = CType(source, System.Web.UI.WebControls.LinkButton)
19..
20.. Select Case LinkButton.ID
21.. Case "HomeLinkButton", "SortLinkButton"
22.. End Select
23.. End Select
24.. Catch ex As Exception
25.. '---Process Exception
26.. End Try
27.. End Function

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I have a grid and a user control on the same page. The user control has a save button that triggers a click event server side. Once the click event happens the page renders, but I need to update the grid information before it renders. Once a conrol's event finishes is there a way to run a method on the parent page so I can update the gid? Any thoughs on how I might
accomplish this?


Nov 19 '05 #5
Hi Rob,

Every Control has a member called "Page" which is a reference to the Page it
is run in.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
There's a seeker born every minute.
- Dr. "Happy" Harry Cox

"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
My methods don't seem to be in Page or am I mising something simple?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:#e**************@TK2MSFTNGP09.phx.gbl...
Page.MethodName()

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Complex things are made up of
Lots of simple things.

"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
>I have a grid and a user control on the same page. The user control has a > save button that triggers a click event server side. Once the click event > happens the page renders, but I need to update the grid information before > it renders. Once a conrol's event finishes is there a way to run a method > on the parent page so I can update the gid? Any thoughs on how I might
> accomplish this?
>
>



Nov 19 '05 #6
Rob,

In that case Kevin's example is perfect for your needs.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
Thanks for the example.... My example was a bit simplified because I'm
dynamically loading the controls and the controls could have anything
within
them. The last thing the control should after it runs any events is to
tell
the page to update itself so it can show the last modifications from the
controls event. The best wqy, that I know, is to have every control call
a
standard method from the parent page that pulls the latest data and then
render.

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:ul**************@TK2MSFTNGP09.phx.gbl...
Rob,

If you want the event to run on the main page only when that button is
clicked you may find out when a button is clicked by overriding the
OnBubbleEvent on the main page like this:

1.. Protected Overrides Function OnBubbleEvent(ByVal source As Object,
ByVal args As System.EventArgs) As Boolean
2.. Try
3.. Select Case (source.GetType.ToString)
4.. Case "System.Web.UI.WebControls.Button"
5.. Dim Button As Button
6..
7.. Button = CType(source, System.Web.UI.WebControls.Button)
8..
9.. Select Case Button.ID
10.. Case "SubmitButton"
11.. '---Call any code you want here: with access to the control's
viewstate.
12..
13.. Case "CancelButton"
14.. End Select
15.. Case "System.Web.UI.WebControls.LinkButton"
16.. Dim LinkButton As LinkButton
17..
18.. LinkButton = CType(source, System.Web.UI.WebControls.LinkButton)
19..
20.. Select Case LinkButton.ID
21.. Case "HomeLinkButton", "SortLinkButton"
22.. End Select
23.. End Select
24.. Catch ex As Exception
25.. '---Process Exception
26.. End Try
27.. End Function

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Rob Morgan" <ro********@ode.state.oh.us> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
>I have a grid and a user control on the same page. The user control has a > save button that triggers a click event server side. Once the click event > happens the page renders, but I need to update the grid information before > it renders. Once a conrol's event finishes is there a way to run a method > on the parent page so I can update the gid? Any thoughs on how I might
> accomplish this?
>
>



Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
4
by: thomson | last post by:
Hi all, i do have a user control with 4 buttons, and all the events are firing properly, My problem is that i need to right an event handler in the user control, which gets fired after a...
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
5
by: Doug Handler | last post by:
Hi, I have a form (Form1) that contains a tab control which one tab has a customer user control (UserControl1). When the user double-clicks on the grid hosted there a new user control is...
1
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP...
0
by: John Smith | last post by:
I still have not gotten this damn thing figured out and I'm asking for help one last time before I give up on it. I have a user control that contains a paged gridview control. The master page...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.