472,119 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

capture click event of multiple image buttons

HI Group!

I have to programmatically create a user input form with various Checkbox
and RadioButton lists - Beside every List I have to place an image button
that is able to reset the checkboxlists and radiobutton lists.

if i declare a variable with

private withEvents img as ImageButton

and have a sub with..

Protected Sub Click1(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) _

Handles img.Click

msgbox("test")

End Sub

My Code for examle iterates 2 times but only one event is captured. So how
can I assure that every event of my buttons (could be 20 or more) is
captured. I would need to reset the value of specific controls with that
code!

Many thanks in advance!

best regards

andy
Mar 24 '07 #1
3 2373
If I read you correctly, you are attempting to set radiobuttons or
checkboxlist items with image buttons, giving the user two ways to set the
selected value(s). If so, let's forget the radiobuttonlist for a moment, as
only one radio button can be checked at any one time, making it the easier
problem to solve.

You can wire all buttons to the same click event. I do not know the VB
syntax to have multiple controls hit the same event, but it is the addition
of a simple delegate assingment in C#. You can easily do this dynamically,
so the buttons will be wired without having to know how many there are. You
then determine which button sets which checkbox, but this is done as you
render the list, so it is not difficult.

When a button is clicked, you call a separate routine that runs through all
of the checkboxes and determines which are checked and which are not. Make
it a separate routine, for reuse. You will call the same routine when you
submit the form, for example.

Hope this helps.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
"Andreas Wöckl" <wo****@esys.atwrote in message
news:Oq**************@TK2MSFTNGP03.phx.gbl...
HI Group!

I have to programmatically create a user input form with various Checkbox
and RadioButton lists - Beside every List I have to place an image button
that is able to reset the checkboxlists and radiobutton lists.

if i declare a variable with

private withEvents img as ImageButton

and have a sub with..

Protected Sub Click1(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) _

Handles img.Click

msgbox("test")

End Sub

My Code for examle iterates 2 times but only one event is captured. So how
can I assure that every event of my buttons (could be 20 or more) is
captured. I would need to reset the value of specific controls with that
code!

Many thanks in advance!

best regards

andy

Mar 24 '07 #2
HI Gregory!

Unfortunately I am a beginner in developing .Net. Do you have some Code for
me to wire all buttons to the same click event? Do I have to define a
variable like

protected withEvents img ImageButton

at the beginning of the class?

My goal is to RESET the values of checkbox or radiobutton lists - not to
set -just to put away the values!

best regards

andy
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMschrieb im
Newsbeitrag news:C3**********************************@microsof t.com...
If I read you correctly, you are attempting to set radiobuttons or
checkboxlist items with image buttons, giving the user two ways to set the
selected value(s). If so, let's forget the radiobuttonlist for a moment,
as only one radio button can be checked at any one time, making it the
easier problem to solve.

You can wire all buttons to the same click event. I do not know the VB
syntax to have multiple controls hit the same event, but it is the
addition of a simple delegate assingment in C#. You can easily do this
dynamically, so the buttons will be wired without having to know how many
there are. You then determine which button sets which checkbox, but this
is done as you render the list, so it is not difficult.

When a button is clicked, you call a separate routine that runs through
all of the checkboxes and determines which are checked and which are not.
Make it a separate routine, for reuse. You will call the same routine when
you submit the form, for example.

Hope this helps.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
"Andreas Wöckl" <wo****@esys.atwrote in message
news:Oq**************@TK2MSFTNGP03.phx.gbl...
>HI Group!

I have to programmatically create a user input form with various Checkbox
and RadioButton lists - Beside every List I have to place an image button
that is able to reset the checkboxlists and radiobutton lists.

if i declare a variable with

private withEvents img as ImageButton

and have a sub with..

Protected Sub Click1(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) _

Handles img.Click

msgbox("test")

End Sub

My Code for examle iterates 2 times but only one event is captured. So
how can I assure that every event of my buttons (could be 20 or more) is
captured. I would need to reset the value of specific controls with that
code!

Many thanks in advance!

best regards

andy


Mar 25 '07 #3
VB.NET or C#?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
"Andreas Wöckl" <wo****@esys.atwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
HI Gregory!

Unfortunately I am a beginner in developing .Net. Do you have some Code
for me to wire all buttons to the same click event? Do I have to define a
variable like

protected withEvents img ImageButton

at the beginning of the class?

My goal is to RESET the values of checkbox or radiobutton lists - not to
set -just to put away the values!

best regards

andy
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMschrieb
im Newsbeitrag news:C3**********************************@microsof t.com...
>If I read you correctly, you are attempting to set radiobuttons or
checkboxlist items with image buttons, giving the user two ways to set
the selected value(s). If so, let's forget the radiobuttonlist for a
moment, as only one radio button can be checked at any one time, making
it the easier problem to solve.

You can wire all buttons to the same click event. I do not know the VB
syntax to have multiple controls hit the same event, but it is the
addition of a simple delegate assingment in C#. You can easily do this
dynamically, so the buttons will be wired without having to know how many
there are. You then determine which button sets which checkbox, but this
is done as you render the list, so it is not difficult.

When a button is clicked, you call a separate routine that runs through
all of the checkboxes and determines which are checked and which are not.
Make it a separate routine, for reuse. You will call the same routine
when you submit the form, for example.

Hope this helps.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
"Andreas Wöckl" <wo****@esys.atwrote in message
news:Oq**************@TK2MSFTNGP03.phx.gbl...
>>HI Group!

I have to programmatically create a user input form with various
Checkbox and RadioButton lists - Beside every List I have to place an
image button that is able to reset the checkboxlists and radiobutton
lists.

if i declare a variable with

private withEvents img as ImageButton

and have a sub with..

Protected Sub Click1(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) _

Handles img.Click

msgbox("test")

End Sub

My Code for examle iterates 2 times but only one event is captured. So
how can I assure that every event of my buttons (could be 20 or more) is
captured. I would need to reset the value of specific controls with that
code!

Many thanks in advance!

best regards

andy


Mar 27 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jay | last post: by
1 post views Thread by Matthew Wieder | last post: by
5 posts views Thread by ewillyb | last post: by
reply views Thread by Oddball | last post: by
2 posts views Thread by mark | last post: by
reply views Thread by leo001 | last post: by

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.