I would like to embed a webpage in a dashboard and pass parameters to it as well.
I did a URL/XSLT view, the problem is that it makes a whole new tab. I need this webpage view to be a tab beneath another sheet. So, I want to just take it into customization mode, make a sheet where I need it and then add the necessary code. The problem is I don’t know how to write the code for this.
In a dashboard, unfortunately you can’t have a mix of tabs and sheets. I’ve had that problem in the past, and I basically just got as creative as I could with what I could do and was able to arrange something that worked.
I regular screen where you are embedding a dashboard, you can get a dashboard into the right sheet, but it doesn’t work if you are purely in a dashboard.
We’ve done this in a few places where we need to show web content dynamically and don’t want the user to have to go out of Epicor to get it. I’ve never implemented it in a dashboard, but it’s all built in the standard customization engine so it should carry through.
You’ll need to initialize it yourself in the customization, but after you reload the customization it shows up just like a standard control. From there you can control the location and sizing.
Here’s an example of some code we used to bootstrap the browser window:
/************************/
/* IN THE SCRIPT CLASS */
/************************/
/*initialize a web browser global variable*/
WebBrowser browserDisplay = new WebBrowser();
/****************************************/
/* IN THE InitializeCustomCode() METHOD */
/****************************************/
/*initialize and define how the browser should look in the InitializeCustomCode() method*/
/*this particular browser expands to fill the whole of a tab defined as customTab*/
browserDisplay.Dock = System.Windows.Forms.DockStyle.Fill;
browserDisplay.Location = new System.Drawing.Point(0, 0);
browserDisplay.MinimumSize = new System.Drawing.Size(20, 20);
browserDisplay.Name = "browserDisplay";
browserDisplay.Size = new System.Drawing.Size(784, 561);
browserDisplay.TabIndex = 9999;
browserDisplay.WebBrowserShortcutsEnabled = false;
browserDisplay.IsWebBrowserContextMenuEnabled = false;
browserDisplay.ScriptErrorsSuppressed = true;
customTab.Controls.Add(browserDisplay);
browserDisplay.BringToFront();
/*navigate to a blank page on initialization*/
browserDisplay.Navigate("about:blank");
/**********************************************/
/* IN SOME EVENT METHOD CREATED BY A WIZARD */
/**********************************************/
/*provide a new url and load that page*/
string newUrl = "http://envisionpp/test/callLogViewer.asp?custnum="+[custid];
browserDisplay.Navigate(newUrl);
Okay, I have made progress. I have the webpage populating when I hard code the value.
private void SetupBrowser()
{
wbSite = new System.Windows.Forms.WebBrowser();
wbSite.Dock = System.Windows.Forms.DockStyle.Fill;
wbSite.Location = new System.Drawing.Point(0,0);
wbSite.MinimumSize = new System.Drawing.Size(20,20);
wbSite.Name = "wbSite";
wbSite.Size = new System.Drawing.Size(560,323);
wbSite.TabIndex=0;
wbSite.WebBrowserShortcutsEnabled = false;
wbSite.IsWebBrowserContextMenuEnabled = false;
wbSite.ScriptErrorsSuppressed = true;
grpboxQuickNotes.Controls.Add(wbSite);
//custnum = epiTextCustNumReference2.Text;
custnum = "24989";
wbSite.Navigate("http://envisionpp/test/callLogViewer.asp?custnum=" + custnum.ToString());
}```
However, I don't want to hard code the value I want the line that is commented out: //custnum = epiTextCustNumReference2.Text to feed the website browser with the customer number.
epiTextCustNumReference2 is the text box that contains the value I need to pass into the webpage. It contains the customer number.
When I just try to put in epiTextCustNumReference2.ToString(); nothing happens. Do I need to have the webpage refresh maybe after I enter a value in that text box. I tried doing the Refresh all after I enter a number in there but it doesn’t work.
It doesnt return the right information and it does it right at launch of dashboard. I need to be able to enter a number in that text box and then refresh and have it go get the correct webpage.
So you’ll have to find a different event to hang it off of. I would think an, “after field change” on that text box would be what you want for that one. I don’t know how the web page stuff works, but I would imagine that you need the set up stuff where you have it, and then just move the navigate to the after field change event.