After Render error variable is null

0 Answers 24 Views
Form General Discussions
Vishnu
Top achievements
Rank 1
Iron
Veteran
Vishnu asked on 21 Dec 2021, 06:21 PM | edited on 21 Dec 2021, 06:23 PM

Hi,

 

After submiting the form, On error handling in Catch, the execption is assign to variable error

After render the vairable error is null

Could please help how to assign execption value to variable error after render

Please see below code.



@{
string error { get; set; }

protected override void OnInitialized()
{
                try{}
                finaly{}
}

async protected override Task OnAfterRenderAsync(bool firstRender)
         {
                    var relativeUri = navigationManager.Uri;
                    var uri = navigationManager.ToAbsoluteUri(relativeUri);

                    if (firstRender){}

if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("isSessionTimeout", out var tempTimeout))
                    {
                           notification?.ShowError(error);
                           //error = "Session timed out";
                           showToast = true;
                    }
}


async Task OnSubmit()
	{
              try{

              }

              catch(exception ex){
                     error = ex.ToString();
              }

       }
}

                    
Vishnu
Top achievements
Rank 1
Iron
Veteran
commented on 23 Dec 2021, 06:57 AM

Hi Team, Please guide on above issue.

Thanks

Vishnu
Top achievements
Rank 1
Iron
Veteran
commented on 04 Jan 2022, 11:09 AM

Hi,

Could you please update on the same

Thanks,

Vishnu Vardhanan

No answers yet. Maybe you can help?

Tags
Form General Discussions
Asked by
Vishnu
Top achievements
Rank 1
Iron
Veteran
Share this question
or