Reputation: 373
I have an embedded chromium client named CefSharp in my Windows Form Application. On application start, I am loading a webpage in cefsharp from project resources using following statement in c#:
web_view.LoadHtml(File.ReadAllText(@".\HelloPage.html"), @".\HelloPage.html");
Page loads successfully. Now I have a button on webpage and I want to navigate to another page designed using jquery-mobile and added to the project resources on this button's click event. I have a button and link on my web page to load another pages as following:
<a id="myLink" class="ui-btn ui-corner-all ui-shadow ui-mini" href="Page2.html" >Rollout</a>
<button type="submit" id="submitData" runat="server" onclick="Page3.html;" class="ui-shadow ui-btn ui-corner-all ui-mini">Submit</button>
Both the above mentioned events gives me Error Loading Page. I tried another technique to call c# method from javascript and make a call to load my page inside that method but couldn't achieve that. Can anybody please help me with this. Its my first project on c#. I want to know where I am doing wrong or what other options do I have to make it work. Thanks in Advance.
Upvotes: 0
Views: 3678
Reputation: 708
change this;
<button type="submit" id="submitData" runat="server" onclick="window.location.href='Page3.html';" class="ui-shadow ui-btn ui-corner-all ui-mini">Submit</button>
Upvotes: 0
Reputation: 9063
Dude it's miles off. I suggest try your code in a web page (hosted locally or remotely) that works. The above code:
onclick="Page3.html;"
Isn't going to work terribly well. Try and refer to a js function in onclick instead, the point is - get a working webpage first - preferably referring to external assets such as a js file and a css stylesheet.
Then you can look at cef packaging. Typically you'll need to set your web assets as embedded resources and access them using
Assembly.GetManifestResourceStream
but you're a long way from that yet. Concentrate on the webpage first.
Upvotes: 4