Glyph icons is not displaying even it contains bootstrap file - c#

I like to use some kind of glyphicons in my page,But it is not showing,But when
tried the below ,(attached images of View with and without this reference )
in my page the whole page changes,i have the bootstrap.min.css page file,and am also tried calling this file,But still it is not working ,Any solution?
Code
<span class="glyphicon glyphicon-unchecked" style="color:#s.mcolor"></span>

Related

HTML 'a' tag missing the 'href' attribute

I would like to ask regarding automatic navigation through website powered by Angular using C# WebBrowser class. The point is to download a certain file from the site. I can navigate to the correct page quite OK (I managed to resolve the issue with an 'input' element without any 'form' that surrounds it, weird angular stuff...). The issue is with downloading the file.
Obviously, I don't want to display the 'Save To' dialog to user that pops up when I invoke click on the element. The thing is, body of the page in the WebBrowser instance looks in the incriminated place like this:
<a class="label clickable ng-star-inserted" draggable="true">
<i class="ng-star-inserted ico ico-file ico-ft-pdf"></i>
<div class="text ng-star-inserted">
<h4>SRS Peer Review Checklist</h4>
<p class="ng-star-inserted">Breanne - 01/04/2019 10:06 PM </p>
<p><span class="state-name ng-star-inserted"></span></p>
</div>
</a>
while in my FireFox browser, the HTML looks like this (notice the 'href' attribute is there):
Surprisingly, the WebBrowser loaded page is missing the 'href' attribute of the 'a' element. All the rest works just fine, so the WebBrowser can't be totally broken. Is there something I am missing? Possibly some Angular-friendly setting that will allow the dynamically built attributes to display properly? The rest of navigation is done more by invoking 'click' or 'submit' events on particular HtmlElement objects.

How to override core common view in Orchard

I am styling up a website that is using Orchard and I have noticed their is a custom content type which has a message, here is a standard message in HTML
<p>Some text</p>
<p>Some more text</p>
This is fine however thanks to the Orchard.Core.Common.Views.Fields.Common.Text.cshtml it is inserting a <br /> after each </p>
Here is their view which is rendering the message
#using Orchard.Utility.Extensions;
#{
string name = Model.ContentField.DisplayName;
}
#if (HasText(name) && HasText(Model.Value)) {
<p class="text-field"><span class="name">#name:</span> <span class="value">#(new MvcHtmlString(Html.Encode((HtmlString) Model.Value).ReplaceNewLinesWith("<br />")))</span></p>
}
How can I override this? I have tried to copy and paste the view into my Themes/View folder but it doesn't seem to override it. I just want to remove the ".ReplaceNewLinesWith("<br />")"
I haven't tried this with Orchard 1.6, however this works fine with the latest version (1.8). The obvious things to check are that your theme is active and that you given your view the correct name. If you want a global override then the View should be in the root of your themes View folder, with the name 'Fields.Common.Text.cshtml'.
If you don't want to change the behaviour for all text fields, then you may want to turn on shape tracing and find an Alternate for the view that is tied to either the field name of the content type that it's contained in (for example 'Fields.Common.Text-SomeTextField.cshtml'. This would reduce the impact of any change you make.
That said, are you sure you're doing the right thing though? If your content contains <p> tags then at least in the latest version, the tags will be stripped, which makes sense since otherwise you'd end up with nested <p> tags:
<p class="text-field"><span class="name">SomeTextField:</span> <span class="value">
<p>Some text</p>
<p>Some more text</p></span>
</p>
Also, as a warning, whilst it is certainly possible to override this view in the latest version of Orchard, the view has actually changed so that the new line processing is no longer in the view. It has been moved out into a Filter Orchard.Core.Common.Services.TextFieldFilter. So if the site is updated in the future you may find that you need to revisit the area.

C# Getting Text from object in web page

I'm trying to recreate an old C# application of mine that streams from an online radio station. Problem with the old one is, it loaded an entire web page just to display a certain area of it, which takes more resources that I would deem necessary. So, now I'm rewriting the entire application, and am looking for a way how I can retrieve text from the following code on the website:
<div id="now" style="visibility: visible; display: block;">
<div class="scroll" style="margin-left: 0.000px;">
<div id="title">SONG_NAME</div>
<div id="artist">SONG_ARTIST</div>
</div>
</div>
This piece is constantly updated on the page, with the name and artist of the current song.
id="title" is the name of the song and id="artist" is the artist of the song.
I would like to retrieve the name and artist every say, 10 seconds or so.
Any idea what code to use for this ?
You'll probably want to pull the entire page back. The main considerations are:
You could request the html as uncompressed and open the stream using HttpWebResponse.GetResponseStream and then read up until the end of the block you need (you'll need to analyse the text as you go), and finally call HttpWebResponse.Close to close the stream and release the connection
If the entire response is compressed it may be more efficient to get the whole thing anyway before decompressing.
You need to test which is more efficient for the specific page you are scraping.
So the usual way is to retrieve the whole html stream, then use regex to find the block you need, and just keep your code simple.
Recommendation
If you want to keep it really simple then look at HtmlAgilityPack, which is even on NuGet to use with Visual Studio 2012. It makes working with html scraping very simple.

Set an image in UI

Im using .net c# MVC3 Model. I need to show a gif called loading when I click save on the page. I used <img src="sourcepath" alt="loading" style="display:none"/> and trying to display it whenever user clicks save button using jquery. I have stored the image temporarily in views folder. Unfortunately, i could not see image on the screen. I can see its division with a small red cross cancel button.
Pls Help
If you're seeing the broken image icon, it means your src "sourcepath" is wrong. You would normally put static content in the Content folder of your site, and access it using /Content/imagename.jpg or /Content/Images/imagename.jpg or similar.
Try to use the search, here you can find an solution the show an spinner when doing ajax requests:
How to show loading spinner in jQuery?

Keeping Tab's Focus on PostBack

I have an asp.net page with 4 tab controls using the following html for each (changing their ID's for each one etc):
<ul id="ulTabs">
<li class="displayItem" id="liSummary" style="display: block"><a ref="#divSummary">
<span style="font-weight: bold; color: #4b6c9e">Margin Analysis Summary</span>
</a></li></ul>
The problem I have is that, on two of the tabs I have GridViews that open a new modal/screen. When this modal/screen is then closed, the page refreshes and the focus automatically goes back to the first tab regardless of which tab was selected when the modal/screen was opened.
Any ideas on how I can keep focus set to the current tab? I've tried a few solutions on different links but have found nothing so far.
Store the ID of the currently opened tab in a HiddenField when the tab opened is changed.
Then on load (after the refresh) open the tab represented by the ID stored in the hidden field.
I've done this with javascript and jquery when I've used jquery tabs in the past and it works really well. In fact, if it helps, here's how to do it with jquery. I'm sure you'll be able to adapt it for your own needs (or if you're doing it all in the code behind the page then it'll be even easier).

Categories