P
Plateriot
Is there a more error proof way of deciding when to try:
Dim li As ListItem
li = Me.cmbSPEC.Items.FindByValue(Session("ssSpec"))
If li IsNot Nothing Then
li.Selected = True
end if
I figured out that I was receiving the error because my dropdown list was
empty
But now on this particular non-working instance, I have appropriately filled
my dropdown list manually in several pages including the one
I want it to work on... like this:
Private Sub FillSpecs()
With Me.cmbSPEC
.DataSource = Vitals_TB.PullSpecialties
.DataTextField = "Specialty"
.DataValueField = "DeptSpecID"
.DataBind()
End With
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
PI = GetLoginData()
WP = GetWorkingProvider(Session("ssWorkingProvID"))
strNUID = PI.strNUID
SecLevel = PI.strSecLevel
Session("ssNUID") = strNUID
FillSpecs()
Dim li As ListItem
li = Me.cmbSPEC.Items.FindByValue(Session("ssSpec"))
If li IsNot Nothing Then
li.Selected = True
Else
'Start the Spec with the providers spec/dept
Session.Add("ssSpec", WP.strProvDept)
'Figure out why this line is throwing a null exception
Me.cmbSPEC.Items.FindByValue(Session("ssSpec")).Selected =
True
'I've mannually filled the combobox...
'I've checked the session variable, both are good -- so why
is it still throwing a null exception?
Me.Label1.Text = Session("ssSpec")
End If
End If
End Sub
it's strange because I have the same exact code on another page, but for
some reason its not working on this page -- what else can I examin to get to
the bottom of this?
Any reasonable suggestions would be greatly appreciated
Dim li As ListItem
li = Me.cmbSPEC.Items.FindByValue(Session("ssSpec"))
If li IsNot Nothing Then
li.Selected = True
end if
I figured out that I was receiving the error because my dropdown list was
empty
But now on this particular non-working instance, I have appropriately filled
my dropdown list manually in several pages including the one
I want it to work on... like this:
Private Sub FillSpecs()
With Me.cmbSPEC
.DataSource = Vitals_TB.PullSpecialties
.DataTextField = "Specialty"
.DataValueField = "DeptSpecID"
.DataBind()
End With
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
PI = GetLoginData()
WP = GetWorkingProvider(Session("ssWorkingProvID"))
strNUID = PI.strNUID
SecLevel = PI.strSecLevel
Session("ssNUID") = strNUID
FillSpecs()
Dim li As ListItem
li = Me.cmbSPEC.Items.FindByValue(Session("ssSpec"))
If li IsNot Nothing Then
li.Selected = True
Else
'Start the Spec with the providers spec/dept
Session.Add("ssSpec", WP.strProvDept)
'Figure out why this line is throwing a null exception
Me.cmbSPEC.Items.FindByValue(Session("ssSpec")).Selected =
True
'I've mannually filled the combobox...
'I've checked the session variable, both are good -- so why
is it still throwing a null exception?
Me.Label1.Text = Session("ssSpec")
End If
End If
End Sub
it's strange because I have the same exact code on another page, but for
some reason its not working on this page -- what else can I examin to get to
the bottom of this?
Any reasonable suggestions would be greatly appreciated