0
나는 다음과 같은 구현이 있습니다중첩 된 중계기 내부에서 레코드 추적을 유지하는 방법은 무엇입니까?
alt text http://i47.tinypic.com/2v16fde.png
당신은 내가 리피터 (기계를 나열) 및 중첩 된 리피터 (각 기계 내부의 WindowsServices 목록)가 볼 수 있듯이. 각 Windows 서비스에 대해 버튼을 사용하여 작업을 수행 할 수 있습니다. 그러나이 작업을 수행하려면 어떤 Machine과 어떤 WindowsService가 관련되어 있는지 알아야합니다.
protected void Page_Init(object sender, EventArgs e)
{
rptMachine.ItemDataBound += new RepeaterItemEventHandler(rptMachine_ItemDataBound);
}
protected void Page_Load(object sender, EventArgs e)
{
// bind the Machine repeater
rptMachine.DataSource = _monitoringService.Machines;
rptMachine.DataBind();
}
protected void rptMachine_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater nestedRepeater = (Repeater) e.Item.FindControl("rptWindowsService");
nestedRepeater.DataSource = ((IMachine) e.Item.DataItem).WindowsServices;
nestedRepeater.DataBind();
Button btnActionInner = null;
// bind the action button situated inside the nested repeater
foreach(RepeaterItem ri in nestedRepeater.Items)
{
if((Button)ri.FindControl("btnAction") != null)
{
btnActionInner = (Button) ri.FindControl("btnAction");
btnActionInner.CommandName = "ActionState";
btnActionInner.CommandArgument = strWindowsService;
}
}
}
}
protected void rptWindowsService_ItemCommand(object source, RepeaterCommandEventArgs e)
{
// do the specific action stop/run for the windows service
if (e.CommandName == "ActionState")
{
if(((Button)(e.CommandSource)).Text.Equals("Stop"))
{
}
else if(((Button)(e.CommandSource)).Text.Equals("Run"))
{
}
}
}
}
}
그래서 기본적으로 내가 조작에 의해 관한 한 쌍의 무엇 (rptWindowsService_ItemCommand
내부) 알아야합니다
이
내 코드입니다.어떻게해야할까요?
더 많은 설명을 요청하십시오.
감사 DataboundItem에