Formview with Javascript RRS feed

  • Question

  • User363578564 posted

    the formview has 3 modes (ReadOnly, Edit and Insert)

    if some fields are NOT filled, the field will be hided in ReadOnly mode

    The javascript is used to access the field object in the formview

    in order to make it not error if some fields are hided in ReadOnly mode

    Formview mode is checked by

    if (fmode == 'Insert' || fmode == 'Edit') {
                    var SelectedDistrict = document.getElementById('<%= FV.FindControl("DDLDistrict").ClientID%>')

    it works in normal formview switch operation.  However, if it is jumped from a list of records of another page to ReadOnly mode of this page, it is still Ok, and then switch to Edit mode

    null reference error happens here <%= FV.FindControl("DDLDistrict").ClientID%>

    any help pls?

    Wednesday, October 25, 2017 9:02 AM

All replies

  • User-707554951 posted

    Hi  TW88

    Only from your description, I couldn’t find the reason for null reference error.

    So, would you please provided us with js code and the code about formview so that I could reproduce your problem and find the reason timely.

    Best Regards


    Thursday, October 26, 2017 2:09 AM
  • User363578564 posted

    Sorry, thank you for your patient

    Spending 2 days to find the error from a control (find a value in formview) outside the formview get postback error.

    now I use SQL to find the value instead.

    Thursday, October 26, 2017 9:51 AM