ASP.NET وجود checkboxlist مع بلدي خانات لطيفة في شبكة 4X5

StackOverflow https://stackoverflow.com/questions/1608501

  •  05-07-2019
  •  | 
  •  

سؤال

ولدي checkboxlist التي إما يعرضها في قائمة

A
B
C
D

وأو أفقيا

A B C D

وأريد أن ترتيبها في شبكة لطيفة مثل هذا

A B C D
E F G H
I J K L

وكيف أفعل ذلك؟

هل كانت مفيدة؟

المحلول

وتحتاج إلى تعيين RepeatDirection <ط> و <وأ href = "http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.repeatcolumns.aspx" يختلط = " noreferrer "> RepeatColumns خصائص CheckBoxList.

<asp:CheckBoxList ID="myCheckBoxList" runat="server" 
     RepeatColumns="4" RepeatDirection="Horizontal">
 <asp:ListItem>A</asp:ListItem>
 <asp:ListItem>B</asp:ListItem> 
 <asp:ListItem>C</asp:ListItem>
 <asp:ListItem>D</asp:ListItem>
 <asp:ListItem>E</asp:ListItem>
 <asp:ListItem>F</asp:ListItem>
 <asp:ListItem>G</asp:ListItem>
 <asp:ListItem>H</asp:ListItem>
 <asp:ListItem>I</asp:ListItem>
 <asp:ListItem>J</asp:ListItem>
 <asp:ListItem>K</asp:ListItem>
 <asp:ListItem>L</asp:ListItem>
 <asp:ListItem>M</asp:ListItem>
 <asp:ListItem>N</asp:ListItem>
 <asp:ListItem>O</asp:ListItem>
 <asp:ListItem>P</asp:ListItem>
 <asp:ListItem>Q</asp:ListItem>
 <asp:ListItem>R</asp:ListItem>
 <asp:ListItem>S</asp:ListItem>
 <asp:ListItem>T</asp:ListItem>
</asp:CheckBoxList>

وهذا سيجعل شبكة 4X5 من خانات الاختيار.

A B C D
E F G H
I J K L
M N O P
Q R S T

نصائح أخرى

وكذلك إذا البنود الخاصة بك دائما ما يكون على شبكة 4X5 ثابتة، وربما كنت أفضل حالا مجرد hardcoding واحد نفسك.

وإلا كنت تريد الذهاب لديك لاستخدام عنصر تحكم مثل قائمة بيانات لربط مصدر البيانات الخاص بك إلى DL من مجرد تحقق عناصر تحكم مربع. والشيء الجميل في قائمة البيانات هو أنه على الأقل سوف تمكنك من السيطرة على عدد من تكرار الأعمدة والاتجاه الذي يكرر فيه.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top