【发布时间】:2014-06-04 05:46:14
【问题描述】:
我有两个网格视图。第一个有一个下拉列表。当用户单击名为“显示”的按钮时,数据将显示在数据来自数据库的两个网格视图上。具有下拉列表的列上的行数据必须与第二个网格视图的第一列上的行进行比较。如果它们相等,会提示一个消息框,说没有更改并且数据不会被保存,否则如果它们不相等,将显示模态弹出窗口询问数据是否正确。
下面是我的比较代码,但它只读取 gridview1 中第一行的值。
For i = 0 To GridView1.Rows.Count - 1
Dim ddl As DropDownList = DirectCast(GridView1.Rows(i).Cells(6).FindControl("dropdowncriteria"), DropDownList)
Dim txt As TextBox = DirectCast(GridView1.Rows(i).Cells(7).FindControl("txtreason"), TextBox)
If ddl.SelectedValue = GridView2.Rows(i).Cells(0).Text And txt.Text = GridView2.Rows(i).Cells(1).Text Then
MessageBox("No Changes Made! Nothing will be Saved.")
Return
Else
lblmsg.Text = "Are you sure that all the Data you've Selected/Entered are Correct?"
mdlpopupmsg.Show()
Return
End If
Next
这一定是什么问题?
提前致谢。
【问题讨论】: