开发者

how to findcontrol inside datalist panel1 control?

I have a literal8 inside panel1 and panel1 inside datalist1 ..

i wanna insert the value in literal1 on page load event using query string ...

ERROR on Page Load : Object reference is not set to the instance of an object

how to make this code workin ?

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Dim lit8 As Literal = DirectCast(DataList1.FindControl(开发者_JAVA技巧"Literal8"), Literal)

        lit8.Text = Me.Request.QueryString("room")
    End Sub


Why don't you do a

if(Panel1.FindControl("Literal8") is Literal)
   (Panel1.FindControl("Literal8") as Literal).Text ="your text";

You should be setting this in Page_Load

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜