get id/text of selected checkbox
-
Based on the number of records i have in my DB, i wil generate a list of checkbox (but not checkbox LIST). So i traverse each row and i dim cbx as new checkbox after which i will have 3 -4 checkbox with the text in my web form. But the problem is... how can i get the id/text when the checkbox is being selected to carry out other function? I used checkbox (programmatically create) instead of checkbox list because i need to deal with tooltip which checkboxlist doesnt allow.. pls help...
-
Based on the number of records i have in my DB, i wil generate a list of checkbox (but not checkbox LIST). So i traverse each row and i dim cbx as new checkbox after which i will have 3 -4 checkbox with the text in my web form. But the problem is... how can i get the id/text when the checkbox is being selected to carry out other function? I used checkbox (programmatically create) instead of checkbox list because i need to deal with tooltip which checkboxlist doesnt allow.. pls help...
If u dont use the checkbox list... u have to follow the same method u use to generate them...
traverse thru the database... check if the current check box (i guess ID of the checkbox is same or related to the database data) is selected... perform the operation
If u use the checkboxlist... useFindControl
... ;) He who controls others may be powerful,
But he who has mastered himself is mightier still. -
Based on the number of records i have in my DB, i wil generate a list of checkbox (but not checkbox LIST). So i traverse each row and i dim cbx as new checkbox after which i will have 3 -4 checkbox with the text in my web form. But the problem is... how can i get the id/text when the checkbox is being selected to carry out other function? I used checkbox (programmatically create) instead of checkbox list because i need to deal with tooltip which checkboxlist doesnt allow.. pls help...
Add
ChechedChange
event handler to each CheckBox. Then in that event you can get those information like this:CheckBox chb = (CheckBox)sender;
string str = chb.Text;
bool b = chb.Checked;
string id = chb.ID;Mazy "I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
-
Add
ChechedChange
event handler to each CheckBox. Then in that event you can get those information like this:CheckBox chb = (CheckBox)sender;
string str = chb.Text;
bool b = chb.Checked;
string id = chb.ID;Mazy "I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
Good one :) Doesnt this take a round trip to the server and back to the client :confused: He who controls others may be powerful,
But he who has mastered himself is mightier still. -
Good one :) Doesnt this take a round trip to the server and back to the client :confused: He who controls others may be powerful,
But he who has mastered himself is mightier still. -
S P S wrote: Doesnt this take a round trip to the server and back to the client Nope, if there are not so much record back from database. Mazy "I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
Whatever the data be there.. it should go to the server for processing, right?? He who controls others may be powerful,
But he who has mastered himself is mightier still. -
Whatever the data be there.. it should go to the server for processing, right?? He who controls others may be powerful,
But he who has mastered himself is mightier still.S P S wrote: Whatever the data be there.. it should go to the server for processing, right?? So what? Database is located on server , data should be read and return to clients. Does it relevant to question of original poster? He asked how to play with CheckBox programically, that all. Is that related to server and client processing ! Mazy "I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
-
Add
ChechedChange
event handler to each CheckBox. Then in that event you can get those information like this:CheckBox chb = (CheckBox)sender;
string str = chb.Text;
bool b = chb.Checked;
string id = chb.ID;Mazy "I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
Add checkedchange event handler? How to? Sorry, i'm not that good in programming. So i need some time to digest everything. Dim cbx As New CheckBox AddHandler cbx.CheckedChanged, AddressOf CheckBox Must i have a subrountine to call the event? private sub checkedchange(byval sender as object.......)
-
Add checkedchange event handler? How to? Sorry, i'm not that good in programming. So i need some time to digest everything. Dim cbx As New CheckBox AddHandler cbx.CheckedChanged, AddressOf CheckBox Must i have a subrountine to call the event? private sub checkedchange(byval sender as object.......)
-
Just like when you add pther handlers, C# syntax:
CheckBox1.CheckedChanged += new System.EventHandler(CheckBox1_CheckedChanged);
Mazy "I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
-
helpNeeded wrote: .net syntax? :wtf: I don't know the VB.NET syntax , C# is a language which support .net framework. If you want to know how you do it in VB , just add a control in desgn time to your webform and then double click on it, so that VS.NET automaticlly add a event handler for you. Then go to your code behind and see how it add than handler. You do the same. Mazy "I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein