2013-04-04 52 views
-1
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating 

    sqlqrystrng = "UPDATE temp_zone set zone_id = @zoneid, zone_name = @zonename WHERE auto_id = @autoid" 

    Dim lbl As Label = GridView1.Rows(e.RowIndex).Cells(0).FindControl("Label5") 
    Dim strautoid As String = lbl.Text 
End Sub 
+0

在其中的代码行有一个例外

尝试找到控制? – 2013-04-04 04:50:20

+0

请更具体的错误发生在哪条线.. – 2013-04-04 04:50:23

+0

需要更多细节。在此发布完整的错误消息。 – viclim 2013-04-04 04:50:44

回答

0

的问题是在该行

Dim strautoid As String = lbl.Text 

因为你在Label变量空值。在row而不是cell作为

Dim lbl As Label = GridView1.Rows(e.RowIndex).FindControl("Label5") 
Dim strautoid As String = lbl.Text 
+0

是的问题是在Dim Strautoid作为字符串= lbl.Text,我认为即时通讯在编辑期间没有在编辑期间使用Lable – 2013-04-04 04:55:29

+0

现在问题解决了,谢谢你帮助我...... – 2013-04-04 04:55:55

+0

请您好好标记答案如果它帮助你。 – 2013-04-04 05:08:50

相关问题