locked
Hidden Field - Cannot implicitly convert type to string to System.Web.Ui.WebControls.HiddenField RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have below code

    <asp:HiddenField ID="hdfEntryNo" runat="server" Value='<%# Bind("EntryNo") %>' />

    HiddenField hdf_EntryNo = (row.FindControl("hdfEntryNo") as HiddenField).Value ;

    Thanks

    Friday, August 17, 2018 12:54 PM

Answers

  • User-369506445 posted

    Hi

    Here you are binding a string to a hidden control

    You have to chane

    string hdf_EntryNo = (row.FindControl("hdfEntryNo") as HiddenField).Value ;

    Or

    HiddenField hdf_EntryNo = (row.FindControl("hdfEntryNo") as HiddenField);
    
    var text=hdf_EntryNo.Value;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 17, 2018 1:23 PM