62,046
社区成员
发帖
与我相关
我的任务
分享
protected void SetAsDefault_Click(object sender, EventArgs e)
{
ErrorType et = new ErrorType();
string isImportant = "0"; //非重保期
ResultInfo rst = et.SaveAlarmThresholdDefaultSet(GetErrorTypeSet(),isImportant);
if (rst.Success)
{
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alt", "alert('保存非重保期默认值成功!');", true);
}
else
{
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alt", "alert('保存非重保期默认值失败!" + rst.Message + "');", true);
}
}
GetErrorTypeSet() 方法如下:
private List<string[]> GetErrorTypeSet()
{
TextBox txtthreshold = null;
DropDownList ddlChannel = null;
string channelvalue = null;
List<string[]> ErrorTypeList = new List<string[]>();
for (int i = 0; i < this.grdErrorTypeClass.Items.Count; i++) //父DataGrid
{
DataGrid grdErrorType = ((DataGrid)grdErrorTypeClass.Items[i].FindControl("grdErrorType"));//子DataGrid
for (int j = 0; j < grdErrorType.Items.Count; j++)
{
if (grdErrorType.Items[j].Cells[0].Text != "-1")
{
string[] paraArray = new string[9];
//paraArray最后一个为Nid,第一个为NETID
paraArray[0] = grdErrorType.Items[j].Cells[10].Text; // NETID
paraArray[8] = grdErrorType.Items[j].Cells[0].Text; // NID
paraArray[1] = grdErrorType.Items[j].Cells[8].Text;
txtthreshold = (TextBox)grdErrorType.Items[j].FindControl("Duration"); //本句就是取页面中”持续时间TextBox“的值
if (txtthreshold != null) //但总是为null
{
paraArray[4] = txtthreshold.Text;
}
......
}
谢谢版主Item[j].Cells[0].FindControl