forcing page to reload

cBarry263

Active member
Joined
Oct 29, 2005
Messages
42
Location
Maryland
Programming Experience
Beginner
Gentlemen,
This is my first foray into ASP programming, I have been developing in VB.NET for a couple years now. I am trying to make a simple page that will query a DB and put the results in a gridview. However, I want the query to change based on a radio button that is selected by the user. When a radio button is selected, I want some options to be disabled. Simple enough in VB.NET, but I found that in ASP these options are not disabled until a button is pushed causing the page to refresh. How can I cause this refresh to happen when the radiobutton is selected, rather than waiting until a command button is pressed. Any help would be greatly appreciated.
 
MSDN says that is for checkboxes, I can't get it to work for radiobuttons, see code:

Protected Sub RadioButton2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged

lblFrom.Enabled =
False
lblTo.Enabled = False
lblFromDate.Enabled = False
lblToDate.Enabled = False
txtFrom.Enabled = False
TxtTo.Enabled = False

lblPlanID.Enabled = True
DropDownList1.Enabled = True

RadioButton2.AutoPostBack = True

End Sub
 
I got it to work now, with this:

Protected Sub RadioButton1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.Load

RadioButton1.AutoPostBack =
True

End Sub

However if there is a more efficient/better way to do this I'd still like to know:)
 
Set the initial properties in Designer View when developing, just select a control and modify each property in the Properties window.
(and you figured out yourself that for AutoPostBack to occur for a specific control, the property has to be True before a change occur..)
 
Back
Top