This is a discussion on Object Reference Error on Custom Control Postback within the .Net Development forums, part of the Programming & Scripting category; I have a main page that contains a repeater control. In the first column, each entry has a radio button. ...
| |||||||
|
#1
| ||||
| ||||
| I have a main page that contains a repeater control. In the first column, each entry has a radio button. A user clicks the radio button of the client they want and then selects from a dropdownlist outside of the repeater depending on the action they want and then clicks a button. This should show a specific custom control based on the selection in the dropdownlist and pass an instance of the client to the specific custom control. Up to this point, it seems to work fine. Each custom control is a form, such as log phonecall, add task etc. However, when you complete details of, for example, a phonecall and click Add, it loses the instance of the client that was passed to it. Content Page:- Code: Select Case ddl_client_option.selectedvalue
Case "phone"
client_phone.visible = true
client_phone.SiteDetails = Master.SiteDetails
client_phone.UserDetails = Master.UserDetails
client_phone.ClientDetails = ClientDetails
client_phone.update_details()
.
.
Code: Private _ClientDetails As ClientBOL
Public Property ClientDetails() As ClientBOL
Get
Return _ClientDetails
End Get
Set(ByVal value As ClientBOL)
_ClientDetails = value
End Set
End Property
I have the same for SiteDetails & UserDetails
Private note as New FileNoteBOL
Public Sub update_details()
If Not IsNothing(ClientDetails) then
txt_homephone.text = ClientDetails.homephone
'this works fine and populates the control.
End If
.
.
.
End Sub
'When the add button is clicked this sub fires
Public Sub add_phonecall(ByVal s As Object, ByVal e As ImageClickEventArgs)
.
.
'this section fires on postback
If IsNothing(ClientDetails) then
update_error.text = "No Client Details"
Exit Sub
End If
'this line gives the Object Reference Error if I remove the section above
note.visitorref = ClientDetails.visitorref
|
|
#2
| ||||
| ||||
| You could always store the values in viewstate...
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Custom Calendar Control | AOG123 | Access Database Samples | 6 | December 10th, 2008 05:34 PM |
| [ASP.Net - Web Controls] reference control from nested repeater | Shem | .Net Development | 18 | September 15th, 2008 10:46 AM |
| Object reference not set to an instance of an object | Shem | .Net Development | 4 | July 22nd, 2008 04:59 AM |
| Retrieving DataItem on Postback | richyrich | .Net Development | 4 | July 21st, 2008 10:15 AM |
| Object reference not set to an instance of an object | jmurrayhead | .Net Development | 1 | May 29th, 2008 10:16 AM |