473,465 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

User control refresh

I have a user control that contains 2 image buttons, when you click one of
them, both must change the image source, the thing is that the first time
you click any one of them the page appears to do a postbak, but the image
source or the image displayed does not change until I click one of the
images a second time, why dows it take 2 clicks for the user to "refresh"?

TIA!
Nov 19 '05 #1
9 2858
TCordian,

If the buttons happen to be in a user control that is being added to the
page dynamically then give the control an ID by adding me.ID =
"MyControlIDHere" to the page load of the control.

I can't tell you why this works exactly, but it does. If this isn't a
dynamically added control please show some source code and I'll see if I can
figure out what's wrong.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
I have a user control that contains 2 image buttons, when you click one of
them, both must change the image source, the thing is that the first time
you click any one of them the page appears to do a postbak, but the image
source or the image displayed does not change until I click one of the
images a second time, why dows it take 2 clicks for the user to "refresh"?

TIA!

Nov 19 '05 #2
This usercontrol has 1 image button that is supposed to do the work, this
control is used for country selection between 2 countries. It also has an
<IMG> that shows the selected country (The imagebutton shows the other
country option) so when toy click the image button it is supposed to change
the <IMG> to show the newly selected country and at that time change a
cookie value and a session var value to hold the current country ID, this
should also refresh the page that contains the usercontrol to show content
according to the current selected country.

The imagebutton_click event is coded as follows:

Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click

If p_IdPais = 1 Then

p_IdPais = 2

Session("IdPais") = 2

Else

p_IdPais = 1

Session("IdPais") = 1

End If

'Set Cookie

Dim ACookie As New HttpCookie("MyPageCountry")

ACookie.Values("Pais") = p_IdPais

ACookie.Expires = DateTime.MaxValue

Response.Cookies.Set(ACookie)

End Sub
HELP APPRECIATED
THANKS
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:OQ**************@TK2MSFTNGP15.phx.gbl...
TCordian,

If the buttons happen to be in a user control that is being added to the
page dynamically then give the control an ID by adding me.ID =
"MyControlIDHere" to the page load of the control.

I can't tell you why this works exactly, but it does. If this isn't a
dynamically added control please show some source code and I'll see if I
can figure out what's wrong.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
I have a user control that contains 2 image buttons, when you click one of
them, both must change the image source, the thing is that the first time
you click any one of them the page appears to do a postbak, but the image
source or the image displayed does not change until I click one of the
images a second time, why dows it take 2 clicks for the user to "refresh"?

TIA!


Nov 19 '05 #3
TCORDON,

Just going through troubleshooting steps here...

Are you using smart navigation?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
This usercontrol has 1 image button that is supposed to do the work, this
control is used for country selection between 2 countries. It also has an
<IMG> that shows the selected country (The imagebutton shows the other
country option) so when toy click the image button it is supposed to
change the <IMG> to show the newly selected country and at that time
change a cookie value and a session var value to hold the current country
ID, this should also refresh the page that contains the usercontrol to
show content according to the current selected country.

The imagebutton_click event is coded as follows:

Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click

If p_IdPais = 1 Then

p_IdPais = 2

Session("IdPais") = 2

Else

p_IdPais = 1

Session("IdPais") = 1

End If

'Set Cookie

Dim ACookie As New HttpCookie("MyPageCountry")

ACookie.Values("Pais") = p_IdPais

ACookie.Expires = DateTime.MaxValue

Response.Cookies.Set(ACookie)

End Sub
HELP APPRECIATED
THANKS
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:OQ**************@TK2MSFTNGP15.phx.gbl...
TCordian,

If the buttons happen to be in a user control that is being added to the
page dynamically then give the control an ID by adding me.ID =
"MyControlIDHere" to the page load of the control.

I can't tell you why this works exactly, but it does. If this isn't a
dynamically added control please show some source code and I'll see if I
can figure out what's wrong.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
I have a user control that contains 2 image buttons, when you click one
of them, both must change the image source, the thing is that the first
time you click any one of them the page appears to do a postbak, but the
image source or the image displayed does not change until I click one of
the images a second time, why dows it take 2 clicks for the user to
"refresh"?

TIA!



Nov 19 '05 #4
No, I´m not.
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:uk**************@TK2MSFTNGP10.phx.gbl...
TCORDON,

Just going through troubleshooting steps here...

Are you using smart navigation?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
This usercontrol has 1 image button that is supposed to do the work, this
control is used for country selection between 2 countries. It also has an
<IMG> that shows the selected country (The imagebutton shows the other
country option) so when toy click the image button it is supposed to
change the <IMG> to show the newly selected country and at that time
change a cookie value and a session var value to hold the current country
ID, this should also refresh the page that contains the usercontrol to
show content according to the current selected country.

The imagebutton_click event is coded as follows:

Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click

If p_IdPais = 1 Then

p_IdPais = 2

Session("IdPais") = 2

Else

p_IdPais = 1

Session("IdPais") = 1

End If

'Set Cookie

Dim ACookie As New HttpCookie("MyPageCountry")

ACookie.Values("Pais") = p_IdPais

ACookie.Expires = DateTime.MaxValue

Response.Cookies.Set(ACookie)

End Sub
HELP APPRECIATED
THANKS
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:OQ**************@TK2MSFTNGP15.phx.gbl...
TCordian,

If the buttons happen to be in a user control that is being added to the
page dynamically then give the control an ID by adding me.ID =
"MyControlIDHere" to the page load of the control.

I can't tell you why this works exactly, but it does. If this isn't a
dynamically added control please show some source code and I'll see if I
can figure out what's wrong.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
I have a user control that contains 2 image buttons, when you click one
of them, both must change the image source, the thing is that the first
time you click any one of them the page appears to do a postbak, but the
image source or the image displayed does not change until I click one of
the images a second time, why dows it take 2 clicks for the user to
"refresh"?

TIA!



Nov 19 '05 #5
Ok,

Then two more questions...

1) How are you setting the image urls?
2) What are the image names?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
No, I´m not.
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:uk**************@TK2MSFTNGP10.phx.gbl...
TCORDON,

Just going through troubleshooting steps here...

Are you using smart navigation?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
This usercontrol has 1 image button that is supposed to do the work,
this control is used for country selection between 2 countries. It also
has an <IMG> that shows the selected country (The imagebutton shows the
other country option) so when toy click the image button it is supposed
to change the <IMG> to show the newly selected country and at that time
change a cookie value and a session var value to hold the current
country ID, this should also refresh the page that contains the
usercontrol to show content according to the current selected country.

The imagebutton_click event is coded as follows:

Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click

If p_IdPais = 1 Then

p_IdPais = 2

Session("IdPais") = 2

Else

p_IdPais = 1

Session("IdPais") = 1

End If

'Set Cookie

Dim ACookie As New HttpCookie("MyPageCountry")

ACookie.Values("Pais") = p_IdPais

ACookie.Expires = DateTime.MaxValue

Response.Cookies.Set(ACookie)

End Sub
HELP APPRECIATED
THANKS
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:OQ**************@TK2MSFTNGP15.phx.gbl...
TCordian,

If the buttons happen to be in a user control that is being added to
the page dynamically then give the control an ID by adding me.ID =
"MyControlIDHere" to the page load of the control.

I can't tell you why this works exactly, but it does. If this isn't a
dynamically added control please show some source code and I'll see if
I can figure out what's wrong.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
>I have a user control that contains 2 image buttons, when you click one
>of them, both must change the image source, the thing is that the first
>time you click any one of them the page appears to do a postbak, but
>the image source or the image displayed does not change until I click
>one of the images a second time, why dows it take 2 clicks for the user
>to "refresh"?
>
> TIA!
>



Nov 19 '05 #6
I got the image thing to work, now there is another problem, When the image
was clicked the usercontrol sets a session variable and a cookie, but there
are other usercontrols in the same page that read that session variable when
they load and depending on its value they load different information, the
problem is that it appears as if they load before the click event from the
image happens, the load when the imagebutton on the first usercontrol send
the postback.

HELP

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP15.phx.gbl...
Ok,

Then two more questions...

1) How are you setting the image urls?
2) What are the image names?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
No, I´m not.
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:uk**************@TK2MSFTNGP10.phx.gbl...
TCORDON,

Just going through troubleshooting steps here...

Are you using smart navigation?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
This usercontrol has 1 image button that is supposed to do the work,
this control is used for country selection between 2 countries. It also
has an <IMG> that shows the selected country (The imagebutton shows the
other country option) so when toy click the image button it is supposed
to change the <IMG> to show the newly selected country and at that time
change a cookie value and a session var value to hold the current
country ID, this should also refresh the page that contains the
usercontrol to show content according to the current selected country.

The imagebutton_click event is coded as follows:

Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click

If p_IdPais = 1 Then

p_IdPais = 2

Session("IdPais") = 2

Else

p_IdPais = 1

Session("IdPais") = 1

End If

'Set Cookie

Dim ACookie As New HttpCookie("MyPageCountry")

ACookie.Values("Pais") = p_IdPais

ACookie.Expires = DateTime.MaxValue

Response.Cookies.Set(ACookie)

End Sub
HELP APPRECIATED
THANKS
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:OQ**************@TK2MSFTNGP15.phx.gbl...
> TCordian,
>
> If the buttons happen to be in a user control that is being added to
> the page dynamically then give the control an ID by adding me.ID =
> "MyControlIDHere" to the page load of the control.
>
> I can't tell you why this works exactly, but it does. If this isn't a
> dynamically added control please show some source code and I'll see if
> I can figure out what's wrong.
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "TCORDON" <tc******@hotmail.com> wrote in message
> news:es**************@TK2MSFTNGP10.phx.gbl...
>>I have a user control that contains 2 image buttons, when you click
>>one of them, both must change the image source, the thing is that the
>>first time you click any one of them the page appears to do a postbak,
>>but the image source or the image displayed does not change until I
>>click one of the images a second time, why dows it take 2 clicks for
>>the user to "refresh"?
>>
>> TIA!
>>
>
>



Nov 19 '05 #7
TCORDON,

Fixing this may require some re-tooling of your application.

If you have multiple controls all counting on the same values then I think
the safest way to do this is to set all of them only after the page load
finishes.

What you should do is create public subroutines in each control that can be
called from the page they are contained in. Put the code for each controls
changes into those subroutines. You can then reference each control just
like you would any other .NET control by declaring it in the codebehind of
the page the control is on.

The next step is to use the OnBubbleEvent to check for the button click from
the image button.

Then call each of the other control's setup subroutines from within the
OnBubbleEvent's code.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I got the image thing to work, now there is another problem, When the image
was clicked the usercontrol sets a session variable and a cookie, but there
are other usercontrols in the same page that read that session variable
when they load and depending on its value they load different information,
the problem is that it appears as if they load before the click event from
the image happens, the load when the imagebutton on the first usercontrol
send the postback.

HELP

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP15.phx.gbl...
Ok,

Then two more questions...

1) How are you setting the image urls?
2) What are the image names?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
No, I´m not.
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:uk**************@TK2MSFTNGP10.phx.gbl...
TCORDON,

Just going through troubleshooting steps here...

Are you using smart navigation?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
> This usercontrol has 1 image button that is supposed to do the work,
> this control is used for country selection between 2 countries. It
> also has an <IMG> that shows the selected country (The imagebutton
> shows the other country option) so when toy click the image button it
> is supposed to change the <IMG> to show the newly selected country and
> at that time change a cookie value and a session var value to hold the
> current country ID, this should also refresh the page that contains
> the usercontrol to show content according to the current selected
> country.
>
> The imagebutton_click event is coded as follows:
>
> Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal e
> As System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click
>
> If p_IdPais = 1 Then
>
> p_IdPais = 2
>
> Session("IdPais") = 2
>
> Else
>
> p_IdPais = 1
>
> Session("IdPais") = 1
>
> End If
>
> 'Set Cookie
>
> Dim ACookie As New HttpCookie("MyPageCountry")
>
> ACookie.Values("Pais") = p_IdPais
>
> ACookie.Expires = DateTime.MaxValue
>
> Response.Cookies.Set(ACookie)
>
> End Sub
>
>
> HELP APPRECIATED
> THANKS
>
>
> "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
> message news:OQ**************@TK2MSFTNGP15.phx.gbl...
>> TCordian,
>>
>> If the buttons happen to be in a user control that is being added to
>> the page dynamically then give the control an ID by adding me.ID =
>> "MyControlIDHere" to the page load of the control.
>>
>> I can't tell you why this works exactly, but it does. If this isn't a
>> dynamically added control please show some source code and I'll see
>> if I can figure out what's wrong.
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "TCORDON" <tc******@hotmail.com> wrote in message
>> news:es**************@TK2MSFTNGP10.phx.gbl...
>>>I have a user control that contains 2 image buttons, when you click
>>>one of them, both must change the image source, the thing is that the
>>>first time you click any one of them the page appears to do a
>>>postbak, but the image source or the image displayed does not change
>>>until I click one of the images a second time, why dows it take 2
>>>clicks for the user to "refresh"?
>>>
>>> TIA!
>>>
>>
>>
>
>



Nov 19 '05 #8
Should that be on the OnBubbleEvent in the form or in the control that
changes the value all other controls reference?

Thanks

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:OW*************@TK2MSFTNGP15.phx.gbl...
TCORDON,

Fixing this may require some re-tooling of your application.

If you have multiple controls all counting on the same values then I think
the safest way to do this is to set all of them only after the page load
finishes.

What you should do is create public subroutines in each control that can
be called from the page they are contained in. Put the code for each
controls changes into those subroutines. You can then reference each
control just like you would any other .NET control by declaring it in the
codebehind of the page the control is on.

The next step is to use the OnBubbleEvent to check for the button click
from the image button.

Then call each of the other control's setup subroutines from within the
OnBubbleEvent's code.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I got the image thing to work, now there is another problem, When the
image was clicked the usercontrol sets a session variable and a cookie,
but there are other usercontrols in the same page that read that session
variable when they load and depending on its value they load different
information, the problem is that it appears as if they load before the
click event from the image happens, the load when the imagebutton on the
first usercontrol send the postback.

HELP

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP15.phx.gbl...
Ok,

Then two more questions...

1) How are you setting the image urls?
2) What are the image names?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
No, I´m not.
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:uk**************@TK2MSFTNGP10.phx.gbl...
> TCORDON,
>
> Just going through troubleshooting steps here...
>
> Are you using smart navigation?
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "TCORDON" <tc******@hotmail.com> wrote in message
> news:uK**************@TK2MSFTNGP09.phx.gbl...
>> This usercontrol has 1 image button that is supposed to do the work,
>> this control is used for country selection between 2 countries. It
>> also has an <IMG> that shows the selected country (The imagebutton
>> shows the other country option) so when toy click the image button it
>> is supposed to change the <IMG> to show the newly selected country
>> and at that time change a cookie value and a session var value to
>> hold the current country ID, this should also refresh the page that
>> contains the usercontrol to show content according to the current
>> selected country.
>>
>> The imagebutton_click event is coded as follows:
>>
>> Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal
>> e As System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click
>>
>> If p_IdPais = 1 Then
>>
>> p_IdPais = 2
>>
>> Session("IdPais") = 2
>>
>> Else
>>
>> p_IdPais = 1
>>
>> Session("IdPais") = 1
>>
>> End If
>>
>> 'Set Cookie
>>
>> Dim ACookie As New HttpCookie("MyPageCountry")
>>
>> ACookie.Values("Pais") = p_IdPais
>>
>> ACookie.Expires = DateTime.MaxValue
>>
>> Response.Cookies.Set(ACookie)
>>
>> End Sub
>>
>>
>> HELP APPRECIATED
>> THANKS
>>
>>
>> "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote
>> in message news:OQ**************@TK2MSFTNGP15.phx.gbl...
>>> TCordian,
>>>
>>> If the buttons happen to be in a user control that is being added to
>>> the page dynamically then give the control an ID by adding me.ID =
>>> "MyControlIDHere" to the page load of the control.
>>>
>>> I can't tell you why this works exactly, but it does. If this isn't
>>> a dynamically added control please show some source code and I'll
>>> see if I can figure out what's wrong.
>>>
>>> --
>>> Sincerely,
>>>
>>> S. Justin Gengo, MCP
>>> Web Developer / Programmer
>>>
>>> www.aboutfortunate.com
>>>
>>> "Out of chaos comes order."
>>> Nietzsche
>>> "TCORDON" <tc******@hotmail.com> wrote in message
>>> news:es**************@TK2MSFTNGP10.phx.gbl...
>>>>I have a user control that contains 2 image buttons, when you click
>>>>one of them, both must change the image source, the thing is that
>>>>the first time you click any one of them the page appears to do a
>>>>postbak, but the image source or the image displayed does not change
>>>>until I click one of the images a second time, why dows it take 2
>>>>clicks for the user to "refresh"?
>>>>
>>>> TIA!
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #9
It should be in the form.

Each control "bubbles" it's events up to the default form. Since you need to
make certain that all controls are loaded before you change them based on
your session variable you can do this from the main form they are contained
in since that form won't receive the bubbled event until all the controls
have been loaded.

To access the OnBubbleEvent you would use code like this:

Protected Overrides Function OnBubbleEvent(ByVal source As Object, ByVal
args As System.EventArgs) As Boolean
Try
Dim Control As System.Web.UI.Control

'---If you have more than one button that could trigger control
changes use a select case (otherwise an if/then would suffice
Select Case Control.ID
Case "[YourButtonIdHere]"
'---Here you can call the public subroutines you set up on
your controls
Call MyUserControl.Setup() '---You could either set your
session variables just before calling the subroutine or pass the necessary
information directly in.
Case "[AnyOtherButtonIDHere]"
'---Fire any code here
End Select
Catch ExceptionCaught As Exception
'---Hanle any exception here
End Try
End Function

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Should that be on the OnBubbleEvent in the form or in the control that
changes the value all other controls reference?

Thanks

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:OW*************@TK2MSFTNGP15.phx.gbl...
TCORDON,

Fixing this may require some re-tooling of your application.

If you have multiple controls all counting on the same values then I
think the safest way to do this is to set all of them only after the page
load finishes.

What you should do is create public subroutines in each control that can
be called from the page they are contained in. Put the code for each
controls changes into those subroutines. You can then reference each
control just like you would any other .NET control by declaring it in the
codebehind of the page the control is on.

The next step is to use the OnBubbleEvent to check for the button click
from the image button.

Then call each of the other control's setup subroutines from within the
OnBubbleEvent's code.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I got the image thing to work, now there is another problem, When the
image was clicked the usercontrol sets a session variable and a cookie,
but there are other usercontrols in the same page that read that session
variable when they load and depending on its value they load different
information, the problem is that it appears as if they load before the
click event from the image happens, the load when the imagebutton on the
first usercontrol send the postback.

HELP

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP15.phx.gbl...
Ok,

Then two more questions...

1) How are you setting the image urls?
2) What are the image names?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"TCORDON" <tc******@hotmail.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
> No, I´m not.
>
>
> "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
> message news:uk**************@TK2MSFTNGP10.phx.gbl...
>> TCORDON,
>>
>> Just going through troubleshooting steps here...
>>
>> Are you using smart navigation?
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "TCORDON" <tc******@hotmail.com> wrote in message
>> news:uK**************@TK2MSFTNGP09.phx.gbl...
>>> This usercontrol has 1 image button that is supposed to do the work,
>>> this control is used for country selection between 2 countries. It
>>> also has an <IMG> that shows the selected country (The imagebutton
>>> shows the other country option) so when toy click the image button
>>> it is supposed to change the <IMG> to show the newly selected
>>> country and at that time change a cookie value and a session var
>>> value to hold the current country ID, this should also refresh the
>>> page that contains the usercontrol to show content according to the
>>> current selected country.
>>>
>>> The imagebutton_click event is coded as follows:
>>>
>>> Private Sub imgNewCountry_Click(ByVal sender As System.Object, ByVal
>>> e As System.Web.UI.ImageClickEventArgs) Handles imgNewCountry.Click
>>>
>>> If p_IdPais = 1 Then
>>>
>>> p_IdPais = 2
>>>
>>> Session("IdPais") = 2
>>>
>>> Else
>>>
>>> p_IdPais = 1
>>>
>>> Session("IdPais") = 1
>>>
>>> End If
>>>
>>> 'Set Cookie
>>>
>>> Dim ACookie As New HttpCookie("MyPageCountry")
>>>
>>> ACookie.Values("Pais") = p_IdPais
>>>
>>> ACookie.Expires = DateTime.MaxValue
>>>
>>> Response.Cookies.Set(ACookie)
>>>
>>> End Sub
>>>
>>>
>>> HELP APPRECIATED
>>> THANKS
>>>
>>>
>>> "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote
>>> in message news:OQ**************@TK2MSFTNGP15.phx.gbl...
>>>> TCordian,
>>>>
>>>> If the buttons happen to be in a user control that is being added
>>>> to the page dynamically then give the control an ID by adding me.ID
>>>> = "MyControlIDHere" to the page load of the control.
>>>>
>>>> I can't tell you why this works exactly, but it does. If this isn't
>>>> a dynamically added control please show some source code and I'll
>>>> see if I can figure out what's wrong.
>>>>
>>>> --
>>>> Sincerely,
>>>>
>>>> S. Justin Gengo, MCP
>>>> Web Developer / Programmer
>>>>
>>>> www.aboutfortunate.com
>>>>
>>>> "Out of chaos comes order."
>>>> Nietzsche
>>>> "TCORDON" <tc******@hotmail.com> wrote in message
>>>> news:es**************@TK2MSFTNGP10.phx.gbl...
>>>>>I have a user control that contains 2 image buttons, when you click
>>>>>one of them, both must change the image source, the thing is that
>>>>>the first time you click any one of them the page appears to do a
>>>>>postbak, but the image source or the image displayed does not
>>>>>change until I click one of the images a second time, why dows it
>>>>>take 2 clicks for the user to "refresh"?
>>>>>
>>>>> TIA!
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #10

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

Similar topics

3
by: MyWebTV | last post by:
how to refresh an indiviual user control without refresh entrire page
6
by: MattB | last post by:
I have a page header that I made as a user control (ascx) that I drop on every page in my application. The application is an eCommerce application and I have a total for items in the cart on the...
4
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
2
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
0
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
3
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
9
by: PJ6 | last post by:
I'm sure it's some attribute I have to set but I can't find it. I'd like to be able to have my properties in my custom web user controls show up in the web forms designer. Is that possible? Paul
3
by: fernandezr | last post by:
I have a navigation user control built using a sqlsitemap in our site's master page. After a user logs in the control doesn't refresh the data in the leftside navigation links. I found I can...
1
by: KatMagic | last post by:
Is there a way to automatically refresh a user control? I have a page where I automatically refresh the page with <meta http-equiv="refresh" content="600"> The page loads a user control based on...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.