G
Guest
Hello all!
I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if
this is the wrong forum!
Synopsis:
In my webform I have 3 nested repeaters:
rpWeeks
----- rpTime
---------- rpClasses
I am databinding the first repeater in the !IsPostBack event of the page,
and the data is coming from a Typed Dataset. The next repeater is DataBound
on its parent's "ItemDataBound"-event and so on:
private void rpWeeks_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Repeater rpTime = (Repeater)e.Item.FindControl("rpTime");
rpTime.ItemDataBound += new
RepeaterItemEventHandler(rpTime_ItemDataBound);
//And here is the code to bind the rpTime-repeater, although I've left it
out for simplicity
}
private void rpTime_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
//Same thing here.. Getting the repeater and binding
}
All this works perfectly!
However, inside the rpClasses-repeater (the last one) I have a CheckBox with
an OnCheckedChanged-event and AutoPostBack=True:
//This event will fire, but RepeaterItem.DataItem is NULL on PostBack !
public void c_CheckedChanged(object sender, EventArgs e)
{
CheckBox c = (CheckBox)sender;
RepeaterItem r = (RepeaterItem)c.Parent;
balletDataset.classnameRow _cnr = (balletDataset.classnameRow)r.DataItem;
//r.DataItem is NULL on each
postback and the application will stop!
Response.Write(_cnr.teacher
+ "<br>");
}
I'm pretty sure that this is a state/event-problem, but what can I do to
solve it? I need to have access to the DataItem of the RepeaterItem because I
have to know what values were selected by the user!
I really hope that someone can help me with this one!
Thanks in advance,
Thomas.
I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if
this is the wrong forum!
Synopsis:
In my webform I have 3 nested repeaters:
rpWeeks
----- rpTime
---------- rpClasses
I am databinding the first repeater in the !IsPostBack event of the page,
and the data is coming from a Typed Dataset. The next repeater is DataBound
on its parent's "ItemDataBound"-event and so on:
private void rpWeeks_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Repeater rpTime = (Repeater)e.Item.FindControl("rpTime");
rpTime.ItemDataBound += new
RepeaterItemEventHandler(rpTime_ItemDataBound);
//And here is the code to bind the rpTime-repeater, although I've left it
out for simplicity
}
private void rpTime_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
//Same thing here.. Getting the repeater and binding
}
All this works perfectly!
However, inside the rpClasses-repeater (the last one) I have a CheckBox with
an OnCheckedChanged-event and AutoPostBack=True:
//This event will fire, but RepeaterItem.DataItem is NULL on PostBack !
public void c_CheckedChanged(object sender, EventArgs e)
{
CheckBox c = (CheckBox)sender;
RepeaterItem r = (RepeaterItem)c.Parent;
balletDataset.classnameRow _cnr = (balletDataset.classnameRow)r.DataItem;
//r.DataItem is NULL on each
postback and the application will stop!
Response.Write(_cnr.teacher
+ "<br>");
}
I'm pretty sure that this is a state/event-problem, but what can I do to
solve it? I need to have access to the DataItem of the RepeaterItem because I
have to know what values were selected by the user!
I really hope that someone can help me with this one!
Thanks in advance,
Thomas.