Показать (контроль этикеток) внутри (элемент управления Repeater) при ТИКе таймера
У меня есть ретранслятор , который показывает вопросы и 4 варианта ответа, я хочу показать правильный ответ через одну минуту
Что я уже пробовал:
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="lblTime" runat="server" /> <br /> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate > <div class="panel-heading"> <div class="panel-title btn-label q-border"> <h3 class="Golden-color"><span class="label label-success" style="margin-left:10px;" id="qid"><%# Eval("Category") %></span><%# Eval("Question") %></h3> </div> <h2 id="counter" class="Golden-color"></h2> </div> <div class="panel-body card "> <div class="quiz" id="quiz" data-toggle="buttons"> <label class="element-animation1 btn btn-lg btn-transparent btn-block"><span class="btn-label">أ</span> <input type="radio" name="q_answer" value="1"> <%# Eval("OptionA") %> </label> <label class="element-animation2 btn btn-lg btn-transparent btn-block"><span class="btn-label">ب</span> <input type="radio" name="q_answer" value="2"> <%# Eval("OptionB") %> </label> <label class="element-animation3 btn btn-lg btn-transparent btn-block"><span class="btn-label">ج</span> <input type="radio" name="q_answer" value="3"> <%# Eval("OptionC") %> </label> <label class="element-animation4 btn btn-lg btn-transparent btn-block"><span class="btn-label">د</span> <input type="radio" name="q_answer" value="4"> <%# Eval("OptionD") %> </label> <asp:Label ID="LblCorrectAnswer" runat="server" Visible="false" Text='<%#Eval("CorrectAnswer")%>' CssClass="label label-success"></asp:Label> </div> </div> </ItemTemplate> </asp:Repeater> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="SELECT TOP 1 * FROM Questions ORDER BY NEWID()"></asp:SqlDataSource> <asp:Timer ID="Timer1" runat="server" OnTick="TimerTick" Interval="10000" Enabled ="true" /> </ContentTemplate> </asp:UpdatePanel>
Protected Sub TimerTick(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then Dim lbl As Label = TryCast(e.Item.FindControl("LblCorrectAnswer"), Label) lbl.Visible = True End If Timer1.Enabled = False End Sub