Home > Net >  In WPF HTML data bind time exception Unknown Name.(Exception from HRESULT: 0x80020006(DISP_E_UNKNOWN
In WPF HTML data bind time exception Unknown Name.(Exception from HRESULT: 0x80020006(DISP_E_UNKNOWN

Time:04-08

I am using WPF with .Net . and when in Application, I am carrying HTML content on web page then There data binding time exception Generated. While as In Debuging time not any exception generated. This is my Code -

public ReopemForm(string policyno)
    {
        InitializeComponent();
        InitailSetup();                      
        pghReopenForm.lblPageHeader.Content = "Agency Add Edit";
        pghReopenForm.lblPageHeader.Visibility = Visibility.Visible;
        pghReopenForm.imgPanel.Visibility = Visibility.Hidden;
        PolicyNo = policyno;
       
    }

private void InitailSetup()
    {
        this.Height = System.Windows.SystemParameters.PrimaryScreenHeight - 130;
        mainGrid.MaxHeight = Height - 50;
        pghReopenForm.Close_Click  = btnClose_Click;
        pghReopenForm.Minimize_Clik  = btnMinimize_Click;
        pghReopenForm.PageTitle = "Policy Add";
        string curDir = Directory.GetCurrentDirectory();
        string countryPath = AILClasses.AILGlobal.CurrentUser.CountryId;
        string ProvincePath = AILClasses.AILGlobal.CurrentUser.ProvinceId;
        string htmlPath = String.Format("file:///{0}/Forms/{1}/{2}/ReopenForm.html", curDir, countryPath, ProvincePath);
        var str = new Uri(htmlPath);
        myWebBrowser.Navigate(str);
        myWebBrowser.Width = frmCustomerAddEdit.Width - 10;
        myWebBrowser.LoadCompleted  = MyWebBrowser_LoadCompleted;
        
       
    }

private void MyWebBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
    {
        try
        {
            //string functionUsername = string.Format(@"document.getElementById('txtappNumber').value = "  PolicyNo   ";");
            // var xyz = myWebBrowser.InvokeScript("eval", new string[] { functionUsername });
            string[] txtappnum = { "txtappNumber", PolicyNo };               
            this.myWebBrowser.InvokeScript("SetKeyValue", txtappnum);
            string[] lblAppnum = { "lblappNumber", PolicyNo };                
            this.myWebBrowser.InvokeScript("SetKeyValuehtml", lblAppnum);
            string[] dateargs = { "txtdate", DateTime.Now.ToShortDateString() };
            this.myWebBrowser.InvokeScript("SetKeyValue", dateargs);                
            string[] datelbl = { "lbldate", DateTime.Now.ToShortDateString() };
            this.myWebBrowser.InvokeScript("SetKeyValuehtml", datelbl);                
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message.ToString());
        }
    }

Please help me to Resolve this. Thank You

CodePudding user response:

visit https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/ms537628(v=vs.85)?redirectedfrom=MSDN

You can try this -

<!-- saved from url=(0016)https://localhost -->
  • Related