|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with RadioButtonIf I make RadioButtons with code, without drawing by mouse than I have problems. I write like this: Dim rb(0 To 2) As RadioButton Dim n As Integer For n = 0 To 2 rb(n) = New RadioButton rb(n).Text = "Text: " + CStr(n) Panel1.Controls.Add(rb(n)) Next Session("rb") = rb Than I call this RadioButton array from session to other procedure: Dim rb(0 To 2) As RadioButton rb = Session("rb") Response.Write(rb(0).Checked) Response.Write(rb(1).Checked) Response.Write(rb(2).Checked) Problem is next: Every RadioButton have property Checked=False even when user check some button. Text property is ok, but checked property is False every time. How to fix it? Igor,
You are taking the behaviour from a checkbox. There will only be one radiobutton in a control that can have the value true.. (If you absolutely don't want checkboxes than you can set every radiobutton in a groupbox (so for 3 buttons you have 3 groupboxes)). I would not do it, because a radiobutton is a radiobutton wich is on or off. Cor Show quoteHide quote <i***@nesalji.hr> schreef in bericht news:en2jfl$2b4$1@sunce.iskon.hr... > RadioButton have property Checked (true or false). > If I make RadioButtons with code, without drawing by mouse than I have > problems. I write like this: > > Dim rb(0 To 2) As RadioButton > Dim n As Integer > > For n = 0 To 2 > rb(n) = New RadioButton > rb(n).Text = "Text: " + CStr(n) > Panel1.Controls.Add(rb(n)) > Next > Session("rb") = rb > > > Than I call this RadioButton array from session to other procedure: > > Dim rb(0 To 2) As RadioButton > rb = Session("rb") > Response.Write(rb(0).Checked) > Response.Write(rb(1).Checked) > Response.Write(rb(2).Checked) > > > Problem is next: Every RadioButton have property Checked=False even when > user check some button. Text property is ok, but checked property is False > every time. > > How to fix it? > > > (If you absolutely don't want checkboxes than you can set every Problem is not group property. It is not written in my code here, but it is > radiobutton in a groupbox (so for 3 buttons you have 3 groupboxes)). I > would not do it, because a radiobutton is a radiobutton wich is on or off. shorter code. I have one groupname for more checkboxes. Problem is that I don't know how to pick checked property from radiobuttoncontrols which is not added by mouse. Controls was addes by code in one procedure. In other procedure I don't view this controll array. If I put this in session in first procedure than radiobuttons are not checked because it is procedure for drowing and user will check it on page after drowing (after program exits from drowing procedure). How to view in other procedure which radiobutton is checked? Oh, no! Nobody knows this!
How to find some control which is added by code (new instance od object on page). How to pick some property of some control which is added by user at run time? Can I find it with FindControl method? How to use findcontrol method? Please help! Igor,
What your code probably does is setting the previous button of by setting the next. There is not something as a group radiobutton. They are all groupbuttons from the page as long as they are not set in a special group. Cor Show quoteHide quote "Igor" <i***@nesalji.hr> schreef in bericht news:en2oar$afs$1@sunce.iskon.hr... > Oh, no! Nobody knows this! > How to find some control which is added by code (new instance od object > on page). How to pick some property of some control which is added by user > at run time? Can I find it with FindControl method? How to use findcontrol > method? Please help! > > > >
VB2005 registering a dll
How do I sort an ArrayList of objects by a property value working with Access in VB.Net Deleting directory path and files. VB.net 2003 textbox delete and undo how to check if the dataset is EOF or if a record exists frist . How to prevent file to be copied Change Connection String during runtime Upgrade for Deployment Purposes how to start explorer to console app location? |
|||||||||||||||||||||||