FormView e.Values empty when using server tags on table

FormView e.Values empty when using server tags on table

Old forum URL: forums.lhotka.net/forums/t/6378.aspx


FBM posted on Monday, February 09, 2009

I have a FormView bound to a CSLADataSource.  I have a html table defined in the FormView and I want to selectively hide rows in the table.  To do so I added server tags to the <tr> rows, so I have something like this:

    <tr id="CityRow" runat="server">
      <td>
        <asp:TextBox ID="CityTextBox" Text='<%# Bind("City") %>'  runat="server" />
      </td>
    </tr>

 

Then in my code I selectively set the visible property on the row.  I have found that when I do this, regardless of whether the row if visible or not, e.Value("City") is empty.  If I remove the server tags on the <tr> then I'll get the e.Value.

Any idea what is going on or a better way to hide the rows?  Thanks.

FBM replied on Monday, February 09, 2009

I've come up with a workaround, although not much different, it works!

I enclosed the row in a <tbody> tag and put the server tags on that and now I get the e.Values.

  <tbody id="CityRow" runat="server" >
    <tr>
      <td>
        <asp:TextBox ID="CityTextBox" Text='<%# Bind("City") %>' runat="server" />
      </td>
    </tr>
   </tbody>

Copyright (c) Marimer LLC