|
-
Feb 25th, 2009, 06:28 AM
#1
Thread Starter
Fanatic Member
Javascript: Looping controls
Guys,
I have a page that holds a checkbox and a repeater control. The repeater control holds instances of a custom webcontrol "QuestionControl.aspx"
QuestionControl has a public property, "Enabled". When I check/uncheck the check box, I want to set each QuestionControl.Enabled = Checkbox.checked.
How can I do this?
In VB it would look something like this....
Code:
For Each itm As RepeaterItem In QRepeater.Items
If TryCast(itm, QuestionsControl) isnot nothing then TryCast(itm,QuestionsControl).enabled = state
Next
Thanks in advance,
Bob
And the aspx page itself...
HTML Code:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="SectionControl.ascx.vb" Inherits="WebUserControl" %>
<%@ Register TagPrefix="Custom" Src="~/QuestionsControl.ascx" TagName="QuestionControl" %>
<asp:CheckBox ID="sectionna" runat="server" Text=" - " Checked="True" />
<asp:label ID="lbl_SectionName" runat="server" Font-Bold="true" Font-Size="Larger" Text="SectionName" />
<br />
<asp:Panel ID="pnl_questions" runat="server" Visible="true">
<br />
<asp:HyperLink ID="doclink" runat="server" Width="260px">No Guidance Available</asp:HyperLink>
<asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="Yes / No" Width="70px"></asp:Label>
<asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="Category" Width="70px"></asp:Label>
<asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="VDS Code" Width="90px"></asp:Label>
<asp:Label ID="Label5" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="Comment" Width="800px"></asp:Label>
<br />
<br />
<asp:Repeater ID="rpt_questions" runat="server">
<%--Implement--%>
<ItemTemplate>
<Custom:QuestionControl runat="server" ID="customControl" QEnabled="False" QCategory='<%#Eval("Category") %>' QVDSCode='<%#Eval("VDSCode") %>' QYesno='<%#Eval("YesNo") %>' QComment='<%#Eval("Comment") %>' QText='<%#Eval("Text") %>' />
<br />
<br />
</ItemTemplate>
</asp:Repeater>
</asp:Panel>
"I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|