Ti s?n thu?c tnh c?a m?t i?u khi?n ListItem ch? ho?t ?ng trong v?ng m?t i?u khi?n HtmlSelect

D?ch tiu ? D?ch tiu ?
ID c?a bi: 309338 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

TRI?U CH?NG

Khi b?n s? d?ng cc RadioButton ho?c Dropdowns ki?m sot, n?u b?n c? g?ng ? ?t m?t c?p gi tr? quan tr?ng trong cc ListItem ki?m sot, c?p gi tr? phm khng ghi ?c vo trang k?t qu?.

V d?, sau y RadioButtonList M?
<asp:RadioButtonList id="RadioButtonList1" runat="server">
	<asp:ListItem Value="v1" Key="k1">1</asp:ListItem>	
</asp:RadioButtonList>
				
- hay -
RadioButtonList1.Items[0].Attributes.Add("key", "k1");
				
ch? tr? v? ?u ra sau y:
<input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="v1" />
<label for="RadioButtonList1_0">1</label>
				
Tng t? nh v?y, sau y Dropdowns M?
<asp:DropDownList id="DropDownList1" runat="server">
	<asp:ListItem Value="v1" Key="k1">1</asp:ListItem>
</asp:DropDownList>
				
ch? tr? v? ?u ra sau y:
<option value=v1>1</option>
				
Cc "Key = k1" khng tr? l?i.

NGUYN NHN

Cc ListItem ki?m sot c m?t ti s?n Thu?c tnh lo?i AttributeCollection. Khi cc ListItem ki?m sot l bn trong m?t RadioButtonList i?u khi?n ho?c m?t Dropdowns ki?m sot, c?p phm gi tr? b?n ch? ?nh cho cc Thu?c tnh ti s?n c?a cc ListItem ki?m sot (ho?c l?p tr?nh ho?c declaratively) khng rendered.

GI?I PHP

? lm vi?c xung quanh v?n ? ny trong cc RadioButtonList ki?m sot, s? d?ng m?t nhm HtmlInputRadioButton i?u khi?n. Vi du:
<input id="Radio01" type="radio" name="group1" Key="k1" runat="server" >
				
? lm vi?c xung quanh v?n ? ny trong cc Dropdowns ki?m sot, s? d?ng cc HtmlSelect ki?m sot. Vi du:
<select runat="server">
	<option value="v1" id="ID1" key="k1">1</option>
</select>
				

T?NH TR?NG

Hnh vi ny l do thi?t k?.

THNG TIN THM

Trong ph?n "Gi?i quy?t" c?a bi vi?t ny, cc HtmlSelect i?u khi?n ?c s? d?ng ? cho th?y lm th? no ? th?c hi?n cc thu?c tnh expando nh l m?t workaround ? s? d?ng cc Dropdowns ki?m sot. Trong khi cc l?p h?c c? hai lm cho vi?c s? d?ng cc ListItem l?p trong n?i b?, h? h? tr? expando thu?c tnh m?t cch khc nhau. Cc HtmlSelect i?u khi?n h? tr? b?ng cch s? d?ng thu?c tnh expando v? m h?nh l?p tr?nh c?a n l hn HTML trung tm. Tuy nhin, h? tr? thu?c tnh expando v?i cc Dropdowns ki?m sot l hn tham gia hn ch? v? cc thu?c tnh chnh h?. V d?, b?n khng th? s? d?ng d? li?u rng bu?c ? h? tr? cc thu?c tnh v?i cc Dropdowns ki?m sot.

Thu?c tnh

ID c?a bi: 309338 - L?n xem xt sau cng: 27 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 1.1
T? kha:
kbprb kbreadme kbservercontrols kbmt KB309338 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:309338

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com