0
내가 선언 한
변수를 변경할 때 드롭 다운 변수 pageload의 데이터 만 갱신에서 채워지지 레이블. , 페이지로드에만 lblHeaderYear
레이블 텍스트는 라벨의 나머지 부분을 채우는 것이 아니라VB.net 레이블은 드롭 다운이 드롭 다운 텍스트를 기반으로
lblHeaderYear.Text = "Year " & strYear
lblHeaderDataCollection.Text = " " & strDataCollection
lblHeaderSubject.Text = " " & strSubject
lblHeaderTeachingGroup.Text = " " & strTeachingGroup
lblHeaderSubroup.Text = " " & strSubgroup
그러나. 그러나 드롭 다운 목록에서 선택하면 모두 표시됩니다. 당신은 모든 드롭 다운리스트 상자의 'SelectedItem.Text'속성을 사용하지 않는 것처럼
<div style="width:100%; height: 100%;">
<asp:Label ID="lblDataCollection" runat="server" Text="Data Collection: " cssclass="label"></asp:Label>
<asp:DropDownList ID="ddlDataCollection" runat="server" DataSourceID="DsDataCollection" DataTextField="DataCollection" DataValueField="DataCollection" CssClass="dropdown" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="DsDataCollection" runat="server" ConnectionString="<%$ ConnectionStrings:MaltingsConnectionString %>" SelectCommand="SELECT DISTINCT DataCollection FROM Subject ORDER BY DataCollection"></asp:SqlDataSource>
<asp:Label ID="lblYear" runat="server" CssClass="label" Text="Year: "></asp:Label>
<asp:DropDownList ID="DdlYear" runat="server" AutoPostBack="True" CssClass="dropdown">
<asp:ListItem Selected="True">11</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>9</asp:ListItem>
<asp:ListItem>8</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lblSubject" runat="server" CssClass="label" Text="Subject: "></asp:Label>
<asp:DropDownList ID="DdlSubject" runat="server" DataSourceID="DsSubject" DataTextField="Subject Name" DataValueField="Subject Name" AutoPostBack="True" CssClass="dropdown">
</asp:DropDownList>
<asp:SqlDataSource ID="DsSubject" runat="server" ConnectionString="<%$ ConnectionStrings:MaltingsConnectionString %>" SelectCommand="SELECT DISTINCT Subject.Name AS 'Subject Name', CASE WHEN Subject.Name LIKE 'English' OR Subject.Name LIKE 'English iGCSE' OR Subject.Name LIKE 'Mathematics' THEN 0 ELSE 1 END AS Ordering, Subject.DataCollection AS Expr1 FROM Student INNER JOIN Subject ON Student.UPN = Subject.UPN WHERE (Student.StuYear = 11) AND (Subject.DataCollection LIKE 'March 2013') ORDER BY Ordering, 'Subject Name'"></asp:SqlDataSource>
<asp:Label ID="LblTeachingGroup" runat="server" Text="Teaching Group: " CssClass="label"></asp:Label>
<asp:DropDownList ID="DdlTeachingGroup" runat="server" DataSourceID="DsTeachingGroup" DataTextField="Teaching Group" DataValueField="Teaching Group" AutoPostBack ="true" CssClass="dropdown">
<asp:ListItem Selected="True" Value="Select All">Select All</asp:ListItem>
</asp:DropDownList>
<br />
<asp:SqlDataSource ID="DsTeachingGroup" runat="server" ConnectionString="<%$ ConnectionStrings:MaltingsConnectionString %>" SelectCommand="SELECT 'Select All' AS 'Teaching Group', 0 AS SortOrder UNION SELECT DISTINCT Subject.TeachingGroup AS 'Teaching Group', 1 AS SortOrder FROM Student INNER JOIN Subject ON Student.UPN = Subject.UPN WHERE (Subject.Name LIKE 'English') AND (Student.StuYear = 11) ORDER BY SortOrder, 'Teaching Group'"></asp:SqlDataSource>
<asp:Label ID="lblSubgroup" runat="server" cssclass="label" style="font-size: 11px" Text="Subgroup: "></asp:Label>
<asp:DropDownList ID="ddlSubgroup" runat="server" cssclass="dropdown" style="font-size: 11px" AutoPostBack="True">
<asp:ListItem Selected="True">Select All</asp:ListItem>
<asp:ListItem Value="GenF">Girls</asp:ListItem>
<asp:ListItem Value="GenM">Boys</asp:ListItem>
<asp:ListItem Value="High">High Attainers</asp:ListItem>
<asp:ListItem Value="Middle">Middle Attainers</asp:ListItem>
<asp:ListItem Value="Low">Low Attainers</asp:ListItem>
<asp:ListItem Value="PPYes">Pupil Premium</asp:ListItem>
<asp:ListItem Value="PPNo">Non-Pupil Premium</asp:ListItem>
<asp:ListItem Value="FSMYes">Free School Meals</asp:ListItem>
<asp:ListItem Value="FSMNo">Non-Free School Meals</asp:ListItem>
<asp:ListItem Value="SENYes">Special Educational Needs</asp:ListItem>
<asp:ListItem Value="SENNo">Non-Special Educational Needs</asp:ListItem>
<asp:ListItem Value="SENS">Statemented</asp:ListItem>
<asp:ListItem Value="SENNoS">Non-Statemented</asp:ListItem>
<asp:ListItem Value="SENAYes">School Action</asp:ListItem>
<asp:ListItem Value="SENANo">Non-School Action</asp:ListItem>
<asp:ListItem Value="SENPYes">School Action Plus</asp:ListItem>
<asp:ListItem Value="SENPNo">Non-School Action Plus</asp:ListItem>
<asp:ListItem Value="EALYes">English as Additional Language</asp:ListItem>
<asp:ListItem Value="EALNo">Non-English as Additional Language</asp:ListItem>
<asp:ListItem Value="LACYes">Looked After Children</asp:ListItem>
<asp:ListItem Value="LACNo">Non-Looked After Children</asp:ListItem>
<asp:ListItem Value="GandTYes">Gifted and Talented</asp:ListItem>
<asp:ListItem Value="GandTNo">Non-Gifted and Talented</asp:ListItem>
<asp:ListItem Value="GiftedYes">Gifted</asp:ListItem>
<asp:ListItem Value="GiftedNo">Non-Gifted</asp:ListItem>
<asp:ListItem Value="TalentYes">Talented</asp:ListItem>
<asp:ListItem Value="TalentNo">Non-Talented</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:Label ID="lblHeaderYear" runat="server" Text="" CssClass="header"></asp:Label>
<asp:Label ID="lblHeaderDataCollection" runat="server" Text="" CssClass="header"></asp:Label>
<asp:Label ID="lblHeaderSubject" runat="server" Text="" CssClass="header"></asp:Label>
<asp:Label ID="lblHeaderTeachingGroup" runat="server" Text="" CssClass="header"></asp:Label>
<asp:Label ID="lblHeaderSubroup" runat="server" Text="" CssClass="header"></asp:Label>
<br />
<br />
</div>
감사합니다. 일부 드롭 다운은 데이터베이스에서 채워 지므로 .text 접미사로 잘 작동하지만 하위 그룹 드롭 다운 목록과 같이 수동으로 정의 된 항목에는 selecteditem.text 접미어가 필요합니다. – Matt