Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Chage textbox property


Message #1 by "welliton alves toledo" <welliton@r...> on Mon, 22 Jul 2002 20:12:42
By using the DataList1_ItemDataBound event, you may do whatever you want 
to your control.

Here is some sample code which I hope can be of use to you.

    Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As 
System.Web.UI.WebControls.DataGridItemEventArgs) Handles 
DataGrid1.ItemDataBound
        If Not IsNothing(e.Item.FindControl("txtEdit1")) Then

            ' Cast the control to its specific type
            Dim textEdit As TextBox = CType(e.Item.FindControl
("txtEdit1"), TextBox)
            ' Change any of its properties
            textEdit.ReadOnly = True

        End If
    End Sub


txtEdit1 will be the id of the textbox in the DataList Item 
Template.


Similar usage of the DataList1_ItemDataBound event is also found in these 
threads:

<headertemplate> - loadtemplate
http://p2p.wrox.com/archive/aspx/2002-05/96.asp

populating a drop down list from within a datagrid
http://p2p.wrox.com/archive/aspx/2002-05/59.asp

aspx thread: making a button control visible/hidden within a datagrid?
http://p2p.wrox.com/view.asp?list=aspx&id=194616

populate textbox in datagrid from custom keypad popup window
http://p2p.wrox.com/view.asp?list=aspx_professional&id=195086


Previous message:
> How I can set in a code-behind the property readonly of a textbox in a 
E> ditItemTemplate of a DataGrid?

> Thanks,

  Return to Index