I have a Web Forms textbox in a gridview and I want to higlight the text on a button click. textbox.select(start,end)
doesn't work. Here is the code:
Dim row As GridViewRow = TryCast(DirectCast(sender, ImageButton).Parent.Parent, GridViewRow)
Dim txtdays As TextBox = row.Cells(2).FindControl("txtDays")
Dim lbldays As Label = row.Cells(2).FindControl("lblDays")
Dim btndel As ImageButton = row.Cells(2).FindControl("btndel")
Dim imgbttnadd As ImageButton = row.Cells(2).FindControl("imgbttnadd")
//Show textbox and set its text.
txtdays.Visible = True
txtdays.Text = lbldays.Text
txtdays.Focus()
//Here is where I want to select the text.
txtdays.Select() //???????? Doesn't work.
How do you do this?
.Select
works on Windows Forms textboxes but not Web Forms textboxes.