I've got a problem with checkboxes in a repeater. The page got four repeaters that lists out links to different pages. This is done in Page_Load. The problem occur when I put checkboxes after each line in the list. When I choose one of them and press a button that I've made to print out the content of the page the link reffers to, the
checkbox lose it's state and nothing happens.
In the Page_Load I call InitRepeaters();
protected void InitRepeaters()
{
if (BIArr.Count > 0){
BIRepeater.DataSource = BIArr;
BIRepeater.DataBind();
}
else{
this.Visible = false;
}
}
The Databind in InitRepeaters is the only one in the codebehind.
This is what I want to happen when I press the Print-button:
protected void printReports_Click(object sender, EventArgs e)
{
CheckBox cb;
foreach(RepeaterItem item in BIRepeater.Items)
{
Control c = item.FindControl("ReportToPrint");
cb = (CheckBox)c;
if(cb.Checked)
{
HtmlInputHidden hih =(HtmlInputHidden)item.FindControl("ReportID");
int repid = Convert.ToInt32( hih.Value);
string rid = repid.ToString();
Page.RegisterStartupScript("myScript","");
}
}
}
I've tried with this in Page_Load:
if (!Page.IsPostBack)
{
InitRepeaters();
}
But when I press the Print-button the print-function still don't work and the repeater-list disappear and the page is blank.
I'm working on EPiServer v4.51 and with .Net 1.1
Someone who can help me?
Sigrid