问候,我会尽量把这句话说清楚
我有一个NumericTextBox和一个按钮,按下按钮它告诉中继器A,它应该根据NumericTextBox上引入的值重复多少次:
protected void ButtonRepeaterA_Click(object sender, EventArgs e)
{
string x = RadNumericTextBoxRepeatsOnA.Text.Trim();
int y = Convert.ToInt32(x);
int[] RowCount = new int[y];
RepeaterA.DataSource = RowCount;
RepeaterA.DataBind();
int currentYear = DateTime.Now.Year;
for (int i = currentYear; i <= currentYear + 100; i++)
{
//DropDownCCYear.Items.Add(new RadComboBoxItem(i.ToString(), i.ToString()));
foreach (RepeaterItem item in RepeaterA.Items)
{
RadComboBox DropDownCCYear = (RadComboBox)item.FindControl("DropDownCCYear");
DropDownCCYear.Items.Add(new RadComboBoxItem(i.ToString(), i.ToString()));
}
}
}中继器B是中继器A中的一个问题。
它的行为类似于中继器A,但我只希望按下按钮会影响按钮所在的中继器,因此它不会清除中继器B的其他重复中引入的控件上引入的数据,如果我使用如下“前端中继器”,会发生什么情况:
protected void ButtonRepeaterB(object sender, EventArgs e)
{
foreach (RepeaterItem item in RepeaterA.Items)
{
Repeater RepeaterB = (Repeater)item.FindControl("RepeaterB");
RadNumericTextBox RadNumericTextBoxRepeatsOnB = (RadNumericTextBox)item.FindControl("RadNumericTextBoxRepeatsOnB");
string x = RadNumericTextBoxRepeatsOnB.Text.Trim();
int y = Convert.ToInt32(x);
int[] RowCount = new int[y];
RepeaterB.DataSource = RowCount;
RepeaterB.DataBind();
}
}是否有“用于此中继器”的-like功能?有什么办法吗?
发布于 2013-07-10 21:12:04
Repeater有一个ItemCommand事件,我认为它对您很有用。当Button的Click事件发生时,如果您没有设置Button的Click事件处理程序,ItemCommand事件将吞噬它。
在ItemCommand事件上,您可以使用e参数来确定哪个按钮,使用sender来确定它来自哪个Repeater。
我被你的问题搞糊涂了,但我想这是你开车去找的答案。这有用吗?
https://stackoverflow.com/questions/17579946
复制相似问题