blounty
Technical User
- Mar 23, 2006
- 46
Hi all,
I am creating a page with a multiview which has 2 views. in one view there is a dropdownlist and in the other a formview. i want to be able to apply the selecteditem text to a label in the insert template of my formview. I understand that i have to use findcontrol() which i have done and works on the first try. if i press cancel in the insert template of my formview and try again i get a NullReferenceException.
my code behind is as follows:
any ideas anyone its hurting my head!
Thanks all.
I am creating a page with a multiview which has 2 views. in one view there is a dropdownlist and in the other a formview. i want to be able to apply the selecteditem text to a label in the insert template of my formview. I understand that i have to use findcontrol() which i have done and works on the first try. if i press cancel in the insert template of my formview and try again i get a NullReferenceException.
my code behind is as follows:
Code:
Partial Class Vehicles
Inherits System.Web.UI.Page
Protected WithEvents branchid As New Label
Public Sub NewVehicle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NewVehicle.Click
Me.VehiclesMultiView.SetActiveView(FormEdit)
Me.FormView1.ChangeMode(FormViewMode.Insert)
branchid = CType(FormView1.Row.FindControl("BranchID"), Label)
branchid.Text = Me.BranchDropDown.SelectedItem.Text
End Sub
End Class
any ideas anyone its hurting my head!
Thanks all.