GridView RowDataBound -- EditItemTemplate vs. ItemTemplate

Discussion in 'ASP .Net' started by K B, Jun 7, 2006.

  1. K B

    K B Guest

    Hi, I'm using the following to change a text label in a specific
    row/control. This works great until I click the Edit commandfield. then
    RowDataBound can't find the Label control because it is now a Textbox.
    How do I indicate the using this code ONLY in ItemTemplate mode?

    If e.Row.RowType = DataControlRowType.DataRow Then
    Dim lbl As Label = CType(e.Row.FindControl("UserName"), Label)
    If lbl.Text = "" Then 'should be blank in only one row

    Thanks!
    KB
     
    K B, Jun 7, 2006
    #1
    1. Advertisements

  2. K B

    Riki Guest

    If e.Row.RowType = DataControlRowType.DataRow And _
    e.Row.RowState=DataControlRowState.Alternate Or _
    e.Row.RowState=DataControlRowState.Normal Then
     
    Riki, Jun 7, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.