I
Iain Buchanan
Moving this code below from v1.1 to 2.0... am now getting this bug...
After I bind a repeater I move the repeater inside the placeholder
using controls.add(), but when I do this, all the children's clientids
change - I also ran a test and then moved the repeater again into a
third placeholder, and surely enough the clientid's change further.
The only work around I have found is to bind the repeater again after I
move the placeholder, but that just feels wrong.
// Bind Data
myRepeater.DataSource = new string[4];
myRepeater.DataBind();
// mClientIDBefore is now "myRepeater_ctl00"
string ClientIDBefore = myRepeater.Controls[0].ClientID;
// Move repeater inside a placeholder
myPlaceHolder.Controls.Add(myRepeater);
// ClientIDAfter is now "myRepeater_ctl04"
string ClientIDAfter = myRepeater.Controls[0].ClientID;
After I bind a repeater I move the repeater inside the placeholder
using controls.add(), but when I do this, all the children's clientids
change - I also ran a test and then moved the repeater again into a
third placeholder, and surely enough the clientid's change further.
The only work around I have found is to bind the repeater again after I
move the placeholder, but that just feels wrong.
// Bind Data
myRepeater.DataSource = new string[4];
myRepeater.DataBind();
// mClientIDBefore is now "myRepeater_ctl00"
string ClientIDBefore = myRepeater.Controls[0].ClientID;
// Move repeater inside a placeholder
myPlaceHolder.Controls.Add(myRepeater);
// ClientIDAfter is now "myRepeater_ctl04"
string ClientIDAfter = myRepeater.Controls[0].ClientID;