This blog shares my journey as a software engineer, along with personal reviews and life experiences I’ve gained along the way. “I have not failed. I've just found 10,000 ways that won't work.” — Thomas Edison. If you enjoy my content, please support it by clicking on ads (free for you, big help for me!) or by buying me a coffee on Ko-fi. Thank you!
Tuesday, February 19, 2013
DropDownList set dl.SelectedValue
Private Sub dg_srvc_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg_srvc.ItemDataBound
If e.Item.ItemType = ListItemType.EditItem Then
Dim dl_span As DropDownList
Dim t As Label
dl_span = CType(e.Item.FindControl("dl_span"), DropDownList)
dl_span.SelectedValue = dl_span.Items.IndexOf(dl_span.Items.FindByText(s_span.Trim.ToLower))
t = CType(e.Item.FindControl("temp"), Label)
t.Text = s_span.Trim
End If
WARNING: ENSURE your values if hard coded match the value from the DB...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment