Nav Tabs stopped showing - c#

I have a page I have been working on, which has some nav tabs on it, which has been working fine until yesterday. When I booted up this am the page no longer shows the tabs. I have closed and reopened VS, I have rebooted my system as well as rebuilding the solution. I've gone through all my code to make sure all tags are closed. I've even gone as far as creating a whole new stand alone page with basic nav tab code and nothing, it doesn't show on the page at all. Any Ideas?
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Mango.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div class="container">
<ul class="nav nav-tabs" id="myTab">
<li class="active">TabA</li>
<li>TabB</li>
<li>TabC</li>
</ul>
<div class="tab-content">
<div id="TabA" class="tab-pane active">
TAB A
</div>
<div id="TabB" class="tab-pane">
TAB B
</div>
<div id="TabC" class="tab-pane">
TAB C
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#myTab a').click(function (e) {
e.preventDefault()
$(this).tab('show')
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
e.relatedTarget // previous tab
});
});
</script>
</asp:Content>

Related

How to solve problem in master page in C#?

I have html code and want to split it between site.master and default.aspx
When I put a full code on site.master it works, but when I took a part of code and put it in default.aspx, it doesn't work!
I just want to know how to make default.aspx reach all classes in .css files
This is my tag which cant take a class from .css
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplicationClinicASP._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<section class="hero-wrap js-fullheight" style="background-image: url('images/bg_3.jpg');" data-section="home" data-stellar-background-ratio="0.5">
<div class="overlay"></div>
<div class="container">
<div class="row no-gutters slider-text js-fullheight align-items-center justify-content-start" data-scrollax-parent="true">
<div class="col-md-6 pt-5 ftco-animate">
<div class="mt-5">
<span class="subheading">Welcome to Mediplus</span>
<h1 class="mb-4">We are here <br>for your Care</h1>
<p class="mb-4">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove.</p>
<p>Make an appointment</p>
</div>
</div>
</div>
</div>
</section>
</asp:Content>

c# Accessing MasterPage elements from Child Page

I've looked at several examples online and none of then seem to work for me.
All I am trying to do is access the contents of a label from the masterpage header.
Here is what i have..
A Label on the Content Page
<asp:Label ID="StaffUserName" runat="Server" />
A Label on the MasterPage called "ThisLoginName"
<header>
<div class="content-wrapper">
<div class="float-left">
<p class="site-title">
<a runat="server" href="~/">Home</a>
</p>
</div>
<div class="float-right">
<section id="login">
Welcome! <b><asp:Label ID="ThisLoginName" runat="server" /></b>
</section>
<nav>
<ul id="menu">
<li><a runat="server" href="~/">Home</a></li>
<li><a runat="server" href="~/Admin">Admin</a></li>
</ul>
</nav>
</div>
</div>
</header>
I've read a few tutorials online but i can't seem to work this out. I do however have this at the top of my content page
<%# MasterType VirtualPath="~/Site.Master" %>
If anyone can help i'd appreciate it.
I think this is what you need.
http://www.aspdotnet-suresh.com/2012/06/access-master-page-control-from-content.html
You need to Add Public properties in Master page class:
public string LabelText
{
get { return StaffUserName.Text; } // StaffUserName is the ID of your LABEL
set { StaffUserName.Text = value; }
}
Seeing you have added: <%# MasterType VirtualPath="~/Site.Master" %> , So in your content page access this as:
Master.LabelText = "MyText";
OR
string test= Master.LabelText;
Fixed..
It was down to the fact that my code to pull the username from the windows login was running at Page load in the masterpage.
So i moved it to the
public void master_Page_PreLoad(object sender, EventArgs e)
section and then it worked.
So it must have been working all along but was pulling through an empty field.
Thanks

Razor View IsAuthenticated not working as expected

I have created a simple MVC application that is using the .Net Membership Provider that is supplied with the new project.
I am trying to get the tabs to show correctly. I might not understand this right but here's my code:
<!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-1.5.1.min.js")" type="text/javascript"></script>
</head>
<body>
<div class="page">
<div id="header">
<div id="title">
<h1>Suburban Customer Portal</h1>
</div>
<div id="logindisplay">
#Html.Partial("_LogOnPartial")
</div>
<div id="menucontainer">
<ul id="menu">
#if (Request.IsAuthenticated)
{
<li>#Html.ActionLink("ChangePassword", "ChangePassword", "Account")</li>
}else {
<li>#Html.ActionLink("Logon", "Logon", "Account")</li>
<li>#Html.ActionLink("Register", "Register", "Account")</li>
}
<li>#Html.ActionLink("ContactUs", "ContactUs", "Home")</li>
</ul>
</div>
</div>
<div id="main">
#RenderBody()
</div>
<div id="footer">
</div>
</div>
</body>
</html>
At this line:
#if (Request.IsAuthenticated)
I am trying to show the right tabs pending on if they are already authenticated. This is always coming out as true...
How should I be doing this? I apparently am not doing it the right way...
Thanks again!
I think you should use
#if(User.Identity.IsAuthenticated)
Well, your question is not very clear, but Request.IsAuthenticated in this line:
#if(Request.IsAuthenticated)
checks if the request has data about an authenticated user. If true, you link will be shown.
In your specific case the Change Password link will only be shown if the user is logged in.
It looks correct.
For the tabs to be hidden, that is, for Request.IsAuthenticated = false you must first logout so that the cookies that store login information are cleared from the user browser.

Issue with silverlight screen loading

I am having a view composed of partial views. Please look at the following image -
I am using JQuery for navigating left side panel. Each right side screen is a partial view. Everything works perfectly. The problem here is with the silverlight screen embed in the following view. Lets check the image -
Each time i click on the code link the silverlight screen is reloaded washing out my contents that i entered in the code editor.
Following is the code -
<div id="scanneredit" class="tabs">
<div class="Navigation">
<div class="header"><%=DataOrModel %> Sections</div>
<ul>
<li>
<div class="inner">
<img alt="Code" src="../../Content/Images/Icon_Code.png" />
Code
<%if (Model.ErrorInSection == 5)
{%>
<div class="ErrorIndicator">
<img alt="General Details" src="../../Content/Images/no.png" />
</div>
<%}
else if (Model.ErrorInSection > 5)
{%>
<div class="ErrorIndicator">
<img alt="General Details" src="../../Content/Images/ok.png" />
</div>
<%} %>
</div>
</li>
</ul>
</div>
<div class="tab">
<%Html.BeginForm("Create", "Scanner", FormMethod.Post, new { id = "createscanner" });%>
.
.
.
<div id="code" class="scanner">
<h3>Code</h3>
<h5>Define core logic of a <%=DataOrModel%>.</h5>
<hr />
<%
Html.RenderPartial("~/Views/Scanner/ScannerCode.ascx", new ViewDataDictionary(Model) );
%>
</div>
.
.
.
</div>
Any help is greatly appreciated.

Disappear Control HTML when click submit in asp.net MVC C#

I create a subscribe block in my page, include text box and button submit. I have a view name SubMail, this is it's content :
<%# Page Language="C#"
Inherits="System.Web.Mvc.ViewPage<Areas.Admin.Models.SubscribeMail>" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>SubscribeMail</title></head>
<body>
<div style="color:#353535;font-size:small;font-family:Verdana;">
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary(true) %>
<div class="editor-label">
Subscribe For Latest Information:
<%: Html.ValidationMessageFor(model => model.Email) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.Email, new { #class =
"flathtmlcontrol", name="Email"})%>
<input type="submit" value=" Submit " class="flathtmlcontrol" />
</div>
<% } %>
</div>
</body>
</html>
I used user control to render the content to my web page, This is my user control file :
<%# Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<iframe src="<%: Url.Action("SubMail","Portfolio") %>" frameborder="0"
scrolling="no" height="70px"></iframe>
The problem is : when I clicked button submit, after page done, The control text box and submit button disappeared in my page, Until I refresh a page, the control is appear normally in my page.
Can anyone tell me , what problem is it?
The control is in an iframe, when you post the form the control contains it loads the iframe with the results of the action method the form posted to.

Categories