开发者

whats wrong in this code?

whats wrong in this code

i have a Imagebutton2 in gridview whose commandname is xxx and i have added modalpopup extendar panel2 with ImageButton2 i want when image button 2 will be clicked then the modalpopup will display and retrieve the values from selected gridview row to the literal3 control of panel 1 which acts as a modalpopup control for gridview ?

 Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        Dim myrow As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow)
        Dim index As Integer = Convert.ToInt32(e.CommandArgument)
        If e.CommandName = "xxx" Then
            Dim lab5 As Label = DirectCast(myrow.FindControl("Label5"), Label)
            Dim lit3 As Literal = Me.Panel2.FindControl("Literal3")
            lit3.T开发者_StackOverflow社区ext = lab5.Text
        End If
        End Sub


Many things can fail:

  • e.CommandArgument may not be an integer
  • e.CommandSource may not be of Control type
  • the NamingContainer may not be of GridViewRow type
  • myRow can be null, at least when the code is ran
  • the "Label5" control may not be found, or may not be of Label type, when the code is ran
  • the "Literal3" control may not be found (null ref) or may not be of Literal type, when the code is ran ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜