This is the code I am trying to modify. I want to add the phone number after the branch. I would like the data to be displayed similar to: BRANCH NAME: phone number (IOWA: (123) 456-7890)
Expand|Select|Wrap|Line Numbers
- <div style="margin-top:15px;margin-bottom:15px;padding:10px;BORDER-TOP: #bfbfa0 1px solid;BORDER-bottom: #bfbfa0 1px solid;">
- <h2>
- <asp:literal id="branch" runat="server"></asp:literal>
- </h2>
- </div>
Expand|Select|Wrap|Line Numbers
- Protected WithEvents contacts As System.Web.UI.WebControls.DataList
- Protected WithEvents branchManagers As System.Web.UI.WebControls.DataList
- Protected WithEvents showManagers As Panel
- Protected WithEvents branch As Literal
- Private Sub bindData()
- 'everything defaults to bettendorf
- Dim branchName As String = "Bettendorf"
- Dim branchNumber As String = Request.QueryString("bid")
- Dim branchLookup As New Hashtable()
- branchLookup.Add("3", "Bettendorf")
- branchLookup.Add("7", "Davenport - Jersey Ridge")
- branchLookup.Add("30", "Davenport - Paul Revere Square")
- Dim cn As MySqlConnection
- Dim da As MySqlDataAdapter
- Dim cmd As MySqlCommand
- Dim ds As New DataSet()
- 'set default branch to bettendorf if its blank
- If (branchNumber = "") Then
- branchNumber = "3"
- End If
- 'Title Case the branch name for display
- branch.Text = branchLookup.Item(branchNumber)
- 'select records for the appropriate branch
- Dim query As String = String.Format("SELECT name,title,phone,alias,branch,manager,branch_id FROM Contact WHERE branch_id = '{0}'", branchNumber)
- Try
- cn = New MySqlConnection(ConfigurationSettings.AppSettings("cnWWW"))
- cn.Open()
- 'populate the data
- da = New MySqlDataAdapter(query, cn)
- da.Fill(ds, "contacts")
- If (ds.Tables("contacts").DefaultView.Count = 0) Then
- cn.Close()
- da.Dispose()
- Response.Redirect("?bid=3")
- Response.End()
- End If
- 'regular users have the "manager" field set to 0
- ds.Tables("contacts").DefaultView.RowFilter = "manager = '0'"
- contacts.DataSource = ds.Tables("contacts")
- contacts.DataBind()
- 'branch managers have the "manager" field set to 1
- ds.Tables("contacts").DefaultView.RowFilter = "manager = '1'"
- 'display the branch managers if there are any
- If (ds.Tables("contacts").DefaultView.Count > 0) Then
- branchManagers.DataSource = ds.Tables("contacts")
- branchManagers.DataBind()
- Else
- showManagers.Visible = False
- End If
- Catch e As Exception
- Response.Redirect("/locations/")
- Finally
- 'clean up
- If (Not IsNothing(cn)) Then
- cn.Close()
- End If
- If (Not IsNothing(da)) Then
- da.Dispose()
- End If
- End Try
- End Sub
I am still new to the .net programming way of things, but it does not seem like it would be that big of a deal to add a phone number into the code - I have about 40 branches total that would need to be edited.
Does anyone have any suggestions - or can you lead me in a direction on where to look for the answer? This is my first attempt to work with a web page that has "code behinds" so I could be missing some very basic rule.
Thank you in advance for any suggestions you may have for me!