ASP.NET dasturlash tilida ArrayList va RadioButtonlarga misollar
Xozir siz bilan ASP.NET
dasturlsh tilida ArrayList va RadioButton lar bilan tanishib
chiqamiz.
Demak men doimgiday dastur kodlarini keltiraman. Izohlar
bilan tushuntirib o’taman.
Dastur kodlari :
<script
runat="server">
Sub Page_Load
if Not Page.IsPostBack then
dim mycountries=New
ArrayList ß!ArrayList obyekti
hosil qilindi-->
mycountries.Add("Norway")
mycountries.Add("Sweden")
mycountries.Add("France")
mycountries.Add(“Uzbekistan”)
mycountries.Add("Italy")
ß!
mycountries listiga ma’lumotlar qo’shildi-->
mycountries.TrimToSize()
mycountries.Sort()
rb.DataSource=mycountries
rb.DataBind()
end if
end sub
sub displayMessage(s as Object,e As EventArgs)
lbl1.text="Men yoqtirgan shaxar: " &
rb.SelectedItem.Text <!—Text hosil qilindi va unga “” ni ichidagi yozuv
qo’yildi-->
end sub
</script> ß! ASP.NET skriptlari
tugadi-->
Menimcha qolgan HTML5
kodlariga qiynalmasdan tushunasiz degan umiddaman.
<!DOCTYPE html>
<html>
<body>
<form runat="server">
<asp:RadioButtonList id="rb"
runat="server"
AutoPostBack="True"
onSelectedIndexChanged="displayMessage" />
<p><asp:label id="lbl1"
runat="server" /></p>
</form>
</body>
</html>
Demak ASP.NET ga
bag’ishlangan darsimiz tugadi. Siz bilan ArrayListni
va RadioButtonlarni qanday qilib
ishlatishni ozgina bo’lsaham o’rganib chiqdik. Keyingi darslarda ko’rishguncha.
Comments
Post a Comment
Iltimos, fikrlaringizni yozib qoldiring !