By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,417 Members | 1,825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,417 IT Pros & Developers. It's quick & easy.

Dynamic Controls

P: n/a
Hi Mr.Steve,

First of all many thanks for your kind response. The thing is that I am
trying to control the user's action of deselecting a checkbox, once he has
selected it. Also the checkbox has been generated dynamically. If it is
selected I do some other processing, so if it is then deselected then the
whole page has to be resetted, hence the sense of displaying the warning
message. The problem is that I dont want the warning message to be displayed
when it is deselected, but only when it is deselected. Hope you understand
me....

Hope you have.....will wait for your kind reply...

Many thanks,

Irfan
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Actually I didn't really understand what you are trying to say. Maybe u could
write it more clearer so that you can get help faster..
From what I can understand, you want this :
whenever a checkbox is 'UnChecked' you want the app to notify you?
You can attach event handlers to your generated checkbox to notify you when
your check box is UnChecked.
I would have wrote more but, Is this what you want?
Hth...
R. Thomas

"Irfan Akram" wrote:
Hi Mr.Steve,

First of all many thanks for your kind response. The thing is that I am
trying to control the user's action of deselecting a checkbox, once he has
selected it. Also the checkbox has been generated dynamically. If it is
selected I do some other processing, so if it is then deselected then the
whole page has to be resetted, hence the sense of displaying the warning
message. The problem is that I dont want the warning message to be displayed
when it is deselected, but only when it is deselected. Hope you understand
me....

Hope you have.....will wait for your kind reply...

Many thanks,

Irfan

Nov 19 '05 #2

P: n/a
Hi Thomas Good Day

I had read the converzation between u and akram but this is
the same thing which i am looking for (i.e)

I have created a set of checkboxs dynamically and now i need
to fire there check and uncheck event so how can i achive this

can v handle this events from code-behind or v got to go for
some client side scripting.
Hope this time u got my query clear

Regards

Jameel

Nov 19 '05 #3

P: n/a
Ok Irfan and Jameel,
Here is what you guys can do.
I think by now you guys must already have a dynamic checkbox right?
So now what you guys need to do is to create a event handler and attach it
to your dynamic checkbox.
Also, do not forget to set the 'AutoPostBack' property of your checkbox to
true.
Here is how u attach an eventhandler to ur checkbox
myCheckBox.CheckedChanged += new EventHandler(myCheckBox_CheckedChanged);
Then make the method to handle it like this :
private void myCheckBox_CheckedChanged(object sender, System.EventArgs e)
{
//Do your processing here
}
After this, set the 'AutoPostBack' property of your dynamic checkbox to true
to that it can fire itself, and you are done!

P.S : If this post helped you, Click 'Yes' on top and rate this post. Thanks

Hth...
R. Thomas

"Irfan Akram" wrote:
Hi Mr.Steve,

First of all many thanks for your kind response. The thing is that I am
trying to control the user's action of deselecting a checkbox, once he has
selected it. Also the checkbox has been generated dynamically. If it is
selected I do some other processing, so if it is then deselected then the
whole page has to be resetted, hence the sense of displaying the warning
message. The problem is that I dont want the warning message to be displayed
when it is deselected, but only when it is deselected. Hope you understand
me....

Hope you have.....will wait for your kind reply...

Many thanks,

Irfan

Nov 19 '05 #4

P: n/a
Hi Thomas,

I have code to do that.

((CheckBox)ctl).CheckedChanged += new
System.EventHandler(this.checkBoxSelected1_3);

The problem is: -

1). This is fired both when the checkbox is selected as well as deselected.
I want a warning message to be displayed only when this is deselected once
selected. I have not managed to find an event handler which only fires when
the checkbox is deselected. How can I achieve that ?

2). I want then a warning message to be displayed, if the checkbox is
selected which I am not able to do.

I hope this clarifies my query.

Thanks,

Irfan

"R. Thomas, aka Xtreme.Net" wrote:
Ok Irfan and Jameel,
Here is what you guys can do.
I think by now you guys must already have a dynamic checkbox right?
So now what you guys need to do is to create a event handler and attach it
to your dynamic checkbox.
Also, do not forget to set the 'AutoPostBack' property of your checkbox to
true.
Here is how u attach an eventhandler to ur checkbox
myCheckBox.CheckedChanged += new EventHandler(myCheckBox_CheckedChanged);
Then make the method to handle it like this :
private void myCheckBox_CheckedChanged(object sender, System.EventArgs e)
{
//Do your processing here
}
After this, set the 'AutoPostBack' property of your dynamic checkbox to true
to that it can fire itself, and you are done!

P.S : If this post helped you, Click 'Yes' on top and rate this post. Thanks

Hth...
R. Thomas

"Irfan Akram" wrote:
Hi Mr.Steve,

First of all many thanks for your kind response. The thing is that I am
trying to control the user's action of deselecting a checkbox, once he has
selected it. Also the checkbox has been generated dynamically. If it is
selected I do some other processing, so if it is then deselected then the
whole page has to be resetted, hence the sense of displaying the warning
message. The problem is that I dont want the warning message to be displayed
when it is deselected, but only when it is deselected. Hope you understand
me....

Hope you have.....will wait for your kind reply...

Many thanks,

Irfan

Nov 19 '05 #5

P: n/a
Ok, When I wrote
//Do your processing here
that is where you CHECK, if the checkbox is being checked or unchecked!
If the checkbox is being checked then do nothing and exit the method
If the checkbox is being Unchecked then do your processing.
U can use an if else statement as so :
if(myCheckBox.Checked)
{
//do nothing and exit the function
}
else
{
//do your processing cause u know that the checkbox in being unchecked!
}

I hope this helps you.

P.S : If this post is helpfull to you, pls click 'Yes' on top of this post

R. Thomas
Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.