110 likes | 253 Vues
This course focuses on server-side design and programming using ASP, emphasizing the use of complex form elements such as checkboxes and radio buttons. You'll learn how to implement interactive user interfaces, manage selection modes for lists, and dynamically generate data using coding techniques. By exploring properties such as `.Text`, `.Checked`, and `.Selected`, participants will build practical skills for manipulating lists and handling user input effectively. Ideal for developers looking to enhance their ASP skills and create robust web applications.
E N D
CSCI 6962: Server-side Design and Programming ASP Server Controls
Complex Form Elements • Checkboxes • Text property gives labelto display next to box • Radio buttons • Lists • SelectionMode can beSingle or Multiple
Lists and List Items • Edit Itemsinterface to add/edit items in this list • Add items to list • Set Text to appear next to it • Set Value to be passed as parameter if selected
Radio Button Lists • Create as RadioButtonListto group together • Same Edit Itemsinterface
Reading CheckBoxes • Checkboxes have Checked property (True or False) • Use to add “Monitor” to peripheralLabel • Like string-based conditional output in JSF (<br/> adds line)
Reading Radio Buttons/Lists • Simplest way to find out which element selected:.selectedValue property • Returns value associated with element (“” if none selected) • Lists handled same way
Reading Multiple-Select Lists • Can use Selectedproperty to check each item in list • Use loop to iterate through all items • Listname.Items.Count gives number of items (loop from 0 to Count – 1) • Listname.Items(i) refers to ith item in list • Listname.Items(i).Selected true if ith item selected • Listname.Items(i).Text gives value of ith item
Reading Multiple-Select Lists Number of items in SoftwareList Was ith item selected? Get text assocciated with ith item Keep count of selected items so know whether any selected
Dynamic List Generation • Adding items to list using code (usually in Page_Load):listname.Items.Add(string) • Example: generating list of months using loop from 1 to 12
Dates in ASP • Key: Date object • Date.Today used to get current time/date • Date.Today.property gets specific values(Year, Month, Day, Hour, …)