1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to get the TestBox ID inside ItemTemplate: asp.net

Discussion in 'C#' started by alanX, Jul 21, 2006.

  1. #1
    Hi all,
    i created some TextBox inside "ItemTemplate" tag using C#, But when i want to get such TextBox's Value. I found it don't allow me to call the TestBox ID directly. (only one row in"DataGrid")
    How can get the values of such TextBox inside "ItemTemplate?

    <script ..>
    private void Function1(Object sender, EventArgs E)
    Label1.Text=Text1.Text; <--can not detect ID "Text1"

    <asp:DataGrid ID="DataGrid1" runat="server"
    <asp: TextBox ID="Text1"....... runat="server">...
    alanX, Jul 21, 2006 IP
  2. benjymouse

    benjymouse Peon

    Likes Received:
    Best Answers:
    Trophy Points:
    TextBox tb = (TextBox) grid1.Items[0].FindControl("Text1");
    Code (markup):
    benjymouse, Jul 22, 2006 IP