|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dropdownlist Chain Visiblefrom the previous drop down list. The 3rd and 4th drop down list, plus a calendar - I would only like visible if certain choices are made in the first and second drop down list. I did using with similar to .... Public Sub _OnSelectedIndexChanged1(ByVal Sender As Object, ByVal e As EventArgs) If DropDownList1.SelectedValue = "Choose a Report Category" Then DropDownList2.Visible = False DropDownList3.Visible = False masterCalendar.Visible = False Else : DropDownList2.Visible = True End If End Sub Public Sub _OnSelectedIndexChanged2(ByVal Sender As Object, ByVal e As EventArgs) If DropDownList2.SelectedValue = "Daily Reports" Then masterCalendar.Visible = True Else : masterCalendar.Visible = False End If End Sub The questions I have is this. 1. Is this the best way to accomplish this? 2. How does changing the visibility properties affect multiple users, using the site at the same time? Thanks ahead of time... new to asp.net. JD Hi JD,
I think that such UI modifications are best handled at the Client end itself, and so you should use Client side scripting to enable / disable or set visibility of such controls at the client browser. I'm assuming that you've set the AutoPostBack property to True, and with each SelectionChange, the event is raised, and the form posts back to the server. In my opinion, there's always a performance penalty to setting the AutoPostBack property of any control to True. Of course, if the data in your Dropdown list is bound to a database, then you cannot avoid posting back to the server. If it's only a question of toggling visibility and filling some static items, then I would suggest using Javascript (or VBScript) to do it. To summarize, there are some validations that are best done at the Client side, and some others that are most useful at the Server side. Hope this helps, Regards, Cerebrus. Thanks...
You are correct I am using AutoPostBack and all the drop down lists are populated by a database. Once this is done, I was going to create a small front end for adding and removing items from the database ( to edit the lists and URLs ). I had considered using static entries, but so far between 4 dropdownlists I am up to over 100 entries. JD Cerebrus wrote: Show quoteHide quote > Hi JD, > > I think that such UI modifications are best handled at the Client end > itself, and so you should use Client side scripting to enable / disable > or set visibility of such controls at the client browser. > > I'm assuming that you've set the AutoPostBack property to True, and > with each SelectionChange, the event is raised, and the form posts back > to the server. In my opinion, there's always a performance penalty to > setting the AutoPostBack property of any control to True. > > Of course, if the data in your Dropdown list is bound to a database, > then you cannot avoid posting back to the server. If it's only a > question of toggling visibility and filling some static items, then I > would suggest using Javascript (or VBScript) to do it. > > To summarize, there are some validations that are best done at the > Client side, and some others that are most useful at the Server side. > > Hope this helps, > > Regards, > > Cerebrus. |
|||||||||||||||||||||||