Let's say I have three button on my page, each assigned a OnClick = "ClickID"
and I have a Label control as a select parameter for the ObjectDataSource "lb_ID"
and I have a formview bind with the ObjectDataSource, with only a Label control inside "lb_Name"
What I try to achieve is each time a button is clicked, the "lb_ID" label text will change and the formview will bind itself to the related record by using the ObjectDataSource
as well as the label "lb_Name" inside of this formview, changes its color.
My problem now is that the binding has no problem, the lb_Name changes its text, but not its ForeColor, I have to click the same button again to change its color, why?
Protected Sub ClickID(ByVal Sender As Object, ByVal e As EventArgs)
Dim ThisLabel As Label = CType(FormView1.FindControl("lb_Name"), Label)
Select Case Sender.ID
lb_ID.Text = "1"
ThisLabel.ForeColor = Drawing.ColorTranslator.FromHtml("#e9ba00")
lb_ID.Text = "2"
ThisLabel.ForeColor = Drawing.ColorTranslator.FromHtml("#DC14E3")
lb_ID.Text = "3"
ThisLabel.ForeColor = Drawing.ColorTranslator.FromHtml("#008fe9")