technicalcreative

Monday, January 21, 2008

For anyone who misses my code...

protected void Select_Changed(object sender, EventArgs e)
{
// Which checkbox dares to interrupt my slumber?
CheckBox myOriginator = (CheckBox)sender;
// Who's your daddy? It's a table row, here represented as a HtmlControl


HtmlControl myDaddy = (HtmlControl)myOriginator.Parent;
// Who's your daddy's daddy? Why, it's that fine fellow, Mr RepeaterItem.
RepeaterItem myGrandpa = (RepeaterItem)myDaddy.Parent;
foreach (RepeaterItem myItem in PeriodRepeater.Items)
{
CheckBox myBox = (CheckBox)myItem.FindControl("Select");
if (myOriginator.Checked)
{
// Your ancestry is weak, old man.
if (myItem.ItemIndex != myGrandpa.ItemIndex)
{
// Mwah!
myDaddy.Visible = false;
}
}
else
{
myDaddy.Visible = true;
}
}
}

2 Comments:

At 7:55 pm, Blogger blackclassical said...

hey c_nty:

pop round here (http://slightlyrougharoundtheedges.wordpress.com/) then give us a shout
greg

 
At 1:02 pm, Blogger Joel Hammond-Turner said...

Nice to see you've not become downtrodden by the application of coding standards and StyleCop! :-)

 

Post a Comment

<< Home