To make this work properly, you need to make a slight change to Jim's code:
Quote:
quote:Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
Dim tb As <s>New </s>TextBox
tb = CType(DetailsView1.FindControl("txtPostId"), TextBox)
tb.Text = Request.QueryString("news")
End Sub
|
First, you don't need the
new keyword, because tb is used to hold the textbox returned from FindControl.
It's also useful to cast the control returned by FindControl to a TextBox using CType, so you can access TextBox specific properties.
Finally, I changed txtPostId.Text to txtPostId in the FindControl argument as I am sure that's what Jim meant anyway....
Cheers
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out
this post.