View Single Post
  #12 (permalink)  
Old April 11th, 2012, 06:41 PM
cagman cagman is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Prepopulating with Variable instead of Constant

Thanks for posting this - Noobie here using DetailsView and trying to pass variables from itemTemplate Label to InsertTemplate textBox. This code works when replacing with a constant but not with variable.
Anyone have advice?
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.PreRender
Dim lblText As Label = CType(DetailsView1.FindControl("SubLabel5"), Label)
If DetailsView1.CurrentMode = DetailsViewMode.Insert Then
Dim ThisControl As TextBox = DetailsView1.FindControl("InsertSubCourseName")
ThisControl.Text = lblText.Text 'Does NOT work!
'ThisControl.Text = "This Works"
End If
End Sub
Reply With Quote