public void DataBindTemplate(object sender, EventArgs e) { PlaceHolder templatePlaceHolder = sender as PlaceHolder; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; OboutRadioButton OboutRadioButton1 = templatePlaceHolder.Controls[0] as OboutRadioButton; OboutRadioButton OboutRadioButton2 = templatePlaceHolder.Controls[1] as OboutRadioButton; object value = DataBinder.Eval(form.DataItem, "Sent"); OboutRadioButton1.Checked = value != null && value.ToString() == "True"; OboutRadioButton2.Checked = value == null || value.ToString() == "False"; }
public void InstantiateIn(Control container) { PlaceHolder templatePlaceHolder = new PlaceHolder(); container.Controls.Add(templatePlaceHolder); OboutRadioButton OboutRadioButton1 = new OboutRadioButton(); templatePlaceHolder.Controls.Add(OboutRadioButton1); OboutRadioButton1.ID = "OboutRadioButton1"; OboutRadioButton1.GroupName = "Sent"; OboutRadioButton1.Text = "Yes"; OboutRadioButton OboutRadioButton2 = new OboutRadioButton(); templatePlaceHolder.Controls.Add(OboutRadioButton2); OboutRadioButton2.ID = "OboutRadioButton2"; OboutRadioButton2.GroupName = "Sent"; OboutRadioButton2.Text = "No"; templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate); }
protected void Poll1_SetSelectedItem(object sender, PollAnswerEventArgs e) { OboutRadioButton OboutRadioButton1 = e.Answer.FindControl("OboutRadioButton1") as OboutRadioButton; OboutRadioButton1.Checked = e.Answer.Item.Selected; }