Leudassdf Posted April 11, 2013 at 01:59 PM Report #502811 Posted April 11, 2013 at 01:59 PM Boas pessoal. Eu tenho uma textbox que esta ligada a base de dados. O que eu desejo é que ao criar as texbox o programa faça um if e modifique o texto dessa mesma texbox. Eu tenho isto, mas dá-me um erro. A referencia do objecto não foi definida como instância de um objecto. Protected Sub DataList1_ItemCreated(sender As Object, e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemCreated Dim textbox As New TextBox textbox = CType(DataList1.FindControl("TextBox1"), TextBox) textbox.Text = "teste" End Sub Alguém sabe como posso mudar o texto da texbox? E como posso saber que texto está actualmente na textbox? Cumprimentos
ruiribeiro Posted May 2, 2013 at 02:54 PM Report #505595 Posted May 2, 2013 at 02:54 PM (edited) vais ter de avaliar a row If e.Item.ItemType = ListItemType.Item Or _ e.Item.ItemType = ListItemType.AlternatingItem Then Dim textbox As New TextBox textbox = CType(DataList1.FindControl("TextBox1"), TextBox) textbox.Text = "teste" end if Não tenho como testar, vê lá se assim funciona Edited May 2, 2013 at 03:03 PM by ruiribeiro .NET/T-SQL, JAVA, PHP, Javascript Developer | Business Intelligence | Gestão de Sistemas de Informação Empresariais
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now