Click here to Skip to main content
16,016,570 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: windows does not have IIS Pin
Guffa25-Jan-07 9:39
Guffa25-Jan-07 9:39 
Questionsession variables vanish Pin
klawipo25-Jan-07 5:42
klawipo25-Jan-07 5:42 
AnswerRe: session variables vanish Pin
ednrgc25-Jan-07 6:40
ednrgc25-Jan-07 6:40 
GeneralRe: session variables vanish Pin
klawipo25-Jan-07 9:12
klawipo25-Jan-07 9:12 
GeneralRe: session variables vanish Pin
ednrgc26-Jan-07 2:33
ednrgc26-Jan-07 2:33 
AnswerRe: session variables vanish Pin
Guffa25-Jan-07 9:42
Guffa25-Jan-07 9:42 
GeneralRe: session variables vanish Pin
klawipo25-Jan-07 22:41
klawipo25-Jan-07 22:41 
QuestionListbox not updating Pin
Quecumber25625-Jan-07 5:23
Quecumber25625-Jan-07 5:23 
Can someone please tell why the list box is not updating?

I have the following procedure to load my list box:
Protected Sub Load_Listbox()
'Purpose: Loads Listbox1 Control with the company titles from
' the AdeptMediaEmployees SQL Server DB
'Parameters: None
'Returns: Nothing
Dim dr As SqlDataReader
Dim cn As SqlConnection = New SqlConnection(MRMFunctions.WebConfigConnString)
Dim ID As String
Dim Title As String
cn.Open()
Try
Dim cd As SqlCommand = New SqlCommand("mrmsp_TitleList", cn)
cd.CommandType = Data.CommandType.StoredProcedure
cd.ExecuteNonQuery()
dr = cd.ExecuteReader
While (dr.Read)
ID = dr("TitleID")
Title = dr("Title")
ListBox1.Items.Add(New ListItem(dr("Title"), dr("TitleID")))
'ListBox1.Items.Add(New ListItem(Title, ID))
End While
Catch ex As Exception
If cn.State <> Data.ConnectionState.Open Then
Msg = "Could not open a connection to the SQL database."
lblErr.Visible = True
lblErr.ForeColor = Drawing.Color.Red
lblErr.Font.Bold = True
lblErr.Text = Msg
End If
Finally
dr.Close()
cn.Close()
End Try
End Sub

The procedure is called from the Page_Load event when the form is first opened.

The problem I have is when I make a change to the data listed in the list box. I call the same procedure from my update event:

Protected Sub btnUpdate_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles btnUpdate.Click

If (txtID.Text <> Nothing) And (txtTitle.Text <> Nothing) Then
lblErr.Visible = False
Dim bCont As Boolean = Update_Titles(CDec(txtID.Text), txtTitle.Text)
If Not bCont Then
Msg = "Update_Titles function failed."
lblErr.Visible = True
lblErr.ForeColor = Drawing.Color.Red
lblErr.Font.Bold = True
lblErr.Text = Msg
Else
lblErr.Visible = False
lblErr.ForeColor = Drawing.Color.Red
lblErr.Font.Bold = False
lblErr.Text = Nothing
Call Load_Listbox()
End If
Else
Msg = "Either the ID# or the Title box is empty. " & _
"Both boxes must be populated before I can " & _
"proceed with the update."
lblErr.Visible = True
lblErr.ForeColor = Drawing.Color.Red
lblErr.Font.Bold = True
lblErr.Text = Msg
End If
End Sub

I know the data is being updated, because I can see the updates in the SQL database. I also know the Load_Listbox procedure is being fired, because I stepped through the process and saw the update take place, but the listbox control was not updated.

Can anyone explain why?

Thank you,


Quecumber256
AnswerRe: Listbox not updating Pin
nour12325-Jan-07 11:08
nour12325-Jan-07 11:08 
AnswerRe: Listbox not updating Pin
ednrgc26-Jan-07 2:46
ednrgc26-Jan-07 2:46 
QuestionFile name losing path. Pin
dspyank25-Jan-07 5:08
dspyank25-Jan-07 5:08 
AnswerRe: File name losing path. Pin
dspyank25-Jan-07 5:15
dspyank25-Jan-07 5:15 
Questionanyone know that how to create tabs like java with ASP.NET 1.1? Pin
good625-Jan-07 3:56
good625-Jan-07 3:56 
AnswerRe: anyone know that how to create tabs like java with ASP.NET 1.1? Pin
Amit Kumar G25-Jan-07 13:36
Amit Kumar G25-Jan-07 13:36 
AnswerRe: anyone know that how to create tabs like java with ASP.NET 1.1? Pin
Artem Kustikov25-Jan-07 21:16
Artem Kustikov25-Jan-07 21:16 
QuestionASP.NET and AJAX Pin
Jens Meyer25-Jan-07 3:33
Jens Meyer25-Jan-07 3:33 
QuestionHow to create an CreateActCtx Pin
rockyl25-Jan-07 3:33
rockyl25-Jan-07 3:33 
Questionhow to get the duration of an mp3 file Pin
Sivaprasad C25-Jan-07 2:58
Sivaprasad C25-Jan-07 2:58 
QuestionInvalidCastException is thrown in my ASP.Net code Pin
rockyl25-Jan-07 2:20
rockyl25-Jan-07 2:20 
Questiona bout Pin
ARAVINDIKA25-Jan-07 1:57
ARAVINDIKA25-Jan-07 1:57 
AnswerRe: a bout Pin
ednrgc25-Jan-07 6:41
ednrgc25-Jan-07 6:41 
QuestionGet IFRAME url Pin
sdsdsds@hotmail.com25-Jan-07 1:42
sdsdsds@hotmail.com25-Jan-07 1:42 
AnswerRe: Get IFRAME url Pin
Paddy Boyd25-Jan-07 3:01
Paddy Boyd25-Jan-07 3:01 
GeneralRe: Get IFRAME url Pin
sdsdsds@hotmail.com25-Jan-07 3:35
sdsdsds@hotmail.com25-Jan-07 3:35 
QuestionWindows 2003 server Session TimeOut Pin
jzb25-Jan-07 1:21
jzb25-Jan-07 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.