I am building a Windows Form to display a web browser with a local file.
I have the webBroswer going to a local file, so far that works:
string path = Directory.GetCurrentDirectory();
this.webBrowser1.Navigate(Path.Combine(path, "index.html"));
and my index.html looks like this:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link href="/Content/bootstrap.min.css" />
<script src="/Scripts/jquery-3.3.1.min.js"></script>
<script src="/Scripts/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<input type="button" value="Here" class="btn btn-default" />
</div>
</div>
</div>
</body>
</html>
and I have installed the NuGet package bootstrap and jquery and it does not appear to be applying to my index.html file....what am I doing wrong?
Here is my file structure, the javascript are in scripts, css files in content
I have tried this path https://code.jquery.com/jquery-3.3.1.min.js but I get a script error.
Related
This is the layout code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- theme meta -->
<meta name="theme-name" content="A Hopefull Life" />
</head>
<body>
<div>
#RenderBody()
</div>
<div>
#RenderSection ("myFAQ")
</div>
</body>
</html>
This is the code for the faq.cshtml:
#{
ViewData["Title"] = "FAQ";
Layout = "/Views/Shared/FAQLayout.cshtml";
}
#section myFAQ{
}
This is a simplified code of the entire website, I thought I did everything accordingly, but I got the error message. I thought it was the contents of the section causing the error (which was a few paragraphs) so I removed it but it wasn't the source.
I am writing a project here I have created layout page and i have located root css files however I cant see "Css" design at my dashboard page I shared layout.cshtml with you Even I located app.StaticFiles just still don work in your opinion whats the problem
I need to finish this project as soon as possible, please help
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://kit.fontawesome.com/7693313d56.js"></script>
<link href="~/css/grid.css" rel="stylesheet" />
<link href="~/css/lightpick.css" rel="stylesheet" />
<link href="~/css/merchatdashboard.css" rel="stylesheet" />
<link href="~/css/mydatetime.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" />
<link href="~/css/style.css" rel="stylesheet" />
<link href="~/css/swipe.css" rel="stylesheet" />
</head>
<body>
<div class="leftmenuswipe">
<div class="leftsidemenuswipe">
#foreach (var item in ViewBag.Menus)
{
<div class="menuitemswipe document">
<div class="icon ">
<img src="#item.MENU_ICON">
</div>
<div class="link ">
#item.MENUNAME_1
</div>
#foreach (var sub in ViewBag.SubMenus)
{
if (item.ID == sub.MENU_PARENT_ID)
{
<ul class="document">
<li>
<a href="">
#sub.MENUNAME_1
</a>
</li>
</ul>
}
}
<div class="clear "></div>
</div>
}
</div>
</div>
<div class="container">
<main role="main" class="pb-3">
#RenderBody()
</main>
</div>
<script src="https://kit.fontawesome.com/7693313d56.js"></script>
<script src="~/js/bar.js"></script>
<script src="~/js/bar_chart.js"></script>
<script src="~/js/chart.js"></script>
<script src="~/js/countdown.js"></script>
<script src="~/js/dashboard.js"></script>
<script src="~/js/dashboardjquery.js"></script>
<script src="~/js/demo.js"></script>
<script src="~/js/lightpick.js"></script>
<script src="~/js/Loginajax.js"></script>
<script src="~/js/piechart.js"></script>
<script src="~/js/pie_chart.js"></script>
<script src="~/js/ReportAjax.js"></script>
<script src="~/js/reportform.js"></script>
<script src="~/js/site.js"></script>
<script src="~/js/swipe.js"></script>
#RenderSection("Scripts", required: false)
</body>
</html>
I dragged the css and javascript files I placed in the layout, it is true in the addresses, I tried every way, it is not solved again
you can look at this pictures which my Project
Can you check the Startup.cs file and see Configure method if it is using staticfiles
If not add
app.UseStaticFiles();
I want some radio buttons styled the way JQuery does it. I've now got demo code working that shows that in a minimal HTML page, but I need to do that now in an ASP.NET C# page. The following code works fine, where REDACTED points to a local-network server:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Radios</title>
<!-- CSS -->
<link rel="stylesheet" href="http://REDACTED/_Kris_Sandbox/css/jquery/jquery-ui.min.css" />
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<!-- JQuery -->
<script type="text/javascript" src="http://REDACTED/_Kris_Sandbox/js/jquery/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="http://REDACTED/_Kris_Sandbox/js/jquery/jquery-ui.min.js"></script>
<script>
$(function() {
$( "#radio" ).buttonset();
});
</script>
</head>
<body>
<form>
<div id="radio">
<input type="radio" id="radio1" name="radio"><label for="radio1">Choice 1</label>
<input type="radio" id="radio2" name="radio" checked="checked"><label for="radio2">Choice 2</label>
<input type="radio" id="radio3" name="radio"><label for="radio3">Choice 3</label>
</div>
</form>
</body>
</html>
But the following shows me ordinary, non-JQuery-styled radio buttons. The date picker does work (showing that JQuery is running) and messages show up as a pop-up and in the console, showing that the function is running, but the buttons aren't being styled.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="travel_temp.aspx.cs" Inherits="_idx" %>
<!DOCTYPE html>
<html>
<head id="hgs_head" runat="server">
<meta charset="utf-8">
<title>JQuery Test</title>
<!-- The following links have been commented out. The internal links point to copies of JQueryUI files that exist and are freshly downloaded from the makers' site. -->
<!-- CSS -->
<link rel="stylesheet" href="http://REDACTED/_Kris_Sandbox/css/jquery/jquery-ui.min.css" />
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<!-- JQuery -->
<script type="text/javascript" src="http://REDACTED/_Kris_Sandbox/js/jquery/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="http://REDACTED/_Kris_Sandbox/js/jquery/jquery-ui.min.js"></script>
<!-- Radio button styling -->
<script>
$(function () {
console.log("ready!");
alert("Hi!");
$("radio").buttonset();
});
</script>
</head>
<body id="hgs_body" runat="server">
<p>Date Picker using JQuery:</p>
<input type="text" name="date" id="date"><script>$("#date").datepicker();</script>
<!-- MAIN CONTENT -->
<div id="main">
<p>Radio Buttons using JQuery:</p>
<form class="messages" id="messages" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server"/>
<div id="radio">
<input type="radio" id="radio1" name="radio"><label for="radio1">Twilight</label>
<input type="radio" id="radio2" name="radio" checked="checked"><label for="radio2">Dash</label>
<input type="radio" id="radio3" name="radio"><label for="radio3">Rarity</label>
</div>
</form>
</div>
</body>
</html>
I figure the problem has to do with this page being ASP.NET with the buttons being created through an .aspx page (the .aspx.cs page is blanked out for demo purposes by the way). But the point of using "$(function" is that it only runs once the page is fully assembled, so the radio buttons should already be there.
What do I need to do, to make the styling work?
(Follow-up note: I didn't do it in this example, but the actual buttons are ASP.NET code. That wasn't the problem though; see answer. If you're having the same problem note that you apparently need to call the JQuery function to style them again if the page updates.)
During page load, you are assigning the buttonset property to element which is of type tag : radio. No such element exists in your DOM. You need to target the div where you want to apply the buttonset. In short, you are missing '#' in your selector.
$(function () {
console.log("ready!");
alert("Hi!");
$("#radio").buttonset();
});
I am opening the same MVC solution in VS2013 and VS2015RC, exact same code, but my VS2015RC tells me there are bunch of errors on my .cshtml pages where as VS2013 says no errors. The main problem is I don't get any intellisense because of the errors in VS2015.
What could be causing this? Also, when I Build the solution in VS2015, it says it succeeded?
Code snippet:
<!DOCTYPE html>
<html>
<head>
<title>#ViewBag.Title</title>
<link href="#Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="#Url.Content("~/Scripts/jquery-2.1.3.min.js")" type="text/javascript"></script>
<meta name="description" content="The description of my page" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div id="header">
<div class="title">ABC</div>
</div>
<div id="categories">
#{ Html.RenderAction("Menu", "Navigation"); }
</div>
<div id="content">
#RenderBody()
</div>
</body>
</html>
vs2013
vs2015
try add this line inside each .cshtml
#inherits System.Web.Mvc.WebViewPage<dynamic>
I have a whole web page source code in a string type variable.
These code is given below:
<!DOCTYPE html>
<html lang="en" dir="ltr"
class="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
<title>Twitter / Authorize an application</title>
<link href="https://abs.twimg.com/a/1373417125/tfw/css/tfw.bundle.css" media="screen" rel="stylesheet" type="text/css" />
<!--[if (IEMobile) & (lt IE 9)]>
<link href="https://abs.twimg.com/a/1373417125/tfw/css/tfw_iemobile.bundle.css" media="screen" rel="stylesheet" type="text/css" />
<![endif]-->
<style type="text/css">
html { display:none; }
</style>
<noscript>
<style type="text/css">
html { display: block; }
</style>
</noscript>
<!--[if IEMobile & lt IE 9]>
<style type="text/css">
html { display: block; }
</style>
<![endif]-->
</head>
<body class="oauth
write
signed-in
tfw
en
logged-in
noloki
">
<div id="header" role="banner">
<div class="bar">
<h1 class="logo">Twitter</h1>
<div id="session" role="navigation">
<h2 class="current-user"><a href="https://twitter.com/xyz" title="Ankita Kumar">
<img src="https://twimg0-a.akamaihd.net/profile_images/37880007865454313/7c577aeb3085dasf355dgf76f043c1cd09_mini.jpeg" alt="" width="24" height="24">
<span class="name">ankita_yahoo</span>
</a></h2>
<div class="user-menu">
<h3 class="session">User Management</h3>
<ul class="session">
<li class="new">New Tweet</li>
<li class="settings">Settings</li>
<li class="help">Help</li>
<li class="signout"><form action="/intent/session" method="post"><div style="margin:0;padding:0"><input name="_method" type="hidden" value="delete" /><input name="authenticity_token" type="hidden" value="015cfb030df22330e517d50b0770c4dab7f3f89b" /></div>
<input id="referer" name="referer" type="hidden" value="/oauth/authorize" />
<input type="submit" class="textual link" value="Sign out">
</form></li>
</ul>
</div>
</div>
</div>
</div>
<div id="bd" role="main">
<p class="action-information">You've granted access to ThisTweetControl!</p>
<div id="oauth_pin">
<p>
<span id="code-desc">Next, return this PIN to complete the authorization process:</span>
<kbd aria-labelledby="code-desc"><code>6107346</code></kbd>
</p>
</div>
</div>
<div class="footer" role="navigation"><div id="ft">
Go to Twitter
Go to the ThisTweetControl homepage
<p class="tip">You can revoke access to any application at any time from the Applications tab of your Settings page.</p>
<p><small>By authorizing an application you continue to operate under Twitter's Terms of Service. In particular, some usage information will be shared back with Twitter. For more, see our Privacy Policy.</small></p>
</div></div>
<script type="text/javascript" charset="utf-8">
var twttr = twttr || {};
twttr.form_authenticity_token = '015cfb03a75wdsfgdf6753dsfb0770c4dab7f3f89b';
if (self == top) {
document.documentElement.style.display = 'block';
}
</script>
<script src="https://abs.twimg.com/a/14353417125/javascripts/loadrunner.js" data-main="tfw/intents/main" data-path="https://abs.twimg.com/a/1373417125/javascripts/modules" type="text/javascript"></script>
</body>
</html>
In above line of code have a code tag <code>6107346</code> with some value and I need to get the numeric value in a variable.
If you use System.Windows.Controls.WebBrowser control then this should work, however it works on assumption that you only have one CODE tag:
var myTagValue = (wbBrowser.Document as mshtml.HTMLDocument)
.getElementsByTagName("CODE")
.OfType<mshtml.IHTMLElement>()
.First()
.innerText
You'll need to reference Internet Explorer's COM library: Microsoft HTML Object Library. getElementsByTagName returns you list of all matching tags, no matter where they are in HTML