My page will not display my multiview views - c#

My views will not be displayed. They were showing but the they suddenly would not show and I do not know why. Please help/advise.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs"
inherits="index" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,700' rel='stylesheet' type='text/css' />
<meta charset="utf-8" />
<link href="Content/bootstrap.css" rel="stylesheet" />
<script src="Scripts/jquery-3.1.0.js"></script>
<script>
$("#menu-toggle1").click(function (e) {
e.preventDefault();
$(".wrapper").toggleClass("toggled");
});
</script>
<style>
body {
font-family: 'Roboto', sans-serif;
font-weight: 300;
}
.jumbotron {
display: flex;
align-items: center;
background-image: url(Images/jquery-site-bkground.jpg);
background-size: cover;
color: #ffffff;
height: 650px;
width: 100%;
text-shadow: 0.25px 0.25px 0.25px #000000;
}
.jumbotron h2 {
font-size: 60px;
font-weight: 700;
margin: 0;
color: #ffffff;
}
.jumbotron h3 {
margin: 0 0 20px;
color: #fff;
}
.sidebar {
float: left;
width: 200px;
margin: 0px;
padding: 0px 20px 0px 0px;
color: #FFFFFF;
border-right-color: black;
border-right-style:solid;
border-right-width: 1px;
}
.wrapper
{
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.wrapper.toggled
{
padding-left: 200px;
}
.sidebar-wrapper
{
z-index: 1000;
position: fixed;
left: 200px;
width: 0;
height: 100%;
margin-left: -200px;
overflow-y: auto;
background: #000000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.wrapper.toggled .sidebar-wrapper
{
width: 200px;
}
.page-content-wrapper
{
width: 100%;
position: absolute;
padding: 15px;
}
.wrapper.toggled .page-content-wrapper
{
position: absolute;
margin-right: -200px;
}
/* Sidebar Styles */
.sidebar-nav
{
position: absolute;
top: 0;
width: 200px;
margin: 0;
padding: 0;
list-style: none;
}
.sidebar-nav li
{
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a
{
display: block;
text-decoration: none;
color: #fff;
}
.sidebar-nav li a:hover
{
text-decoration: none;
color: #ffff80;
font-weight:bold;
background: rgba(255,255,255,0.2);
}
.sidebar-nav li a:active, .sidebar-nav li a:focus
{
text-decoration: none;
}
.sidebar-nav > .sidebar-brand
{
height: 65px;
font-size: 20px;
font-family:Arial;
line-height: 60px;
}
.sidebar-nav > .sidebar-brand a
{
color: #999999;
}
.sidebar-nav > .sidebar-brand a:hover
{
color: #fff;
background: none;
}
#media (min-width:768px)
{
.wrapper
{
padding-left: 200px;
}
.wrapper.toggled
{
padding-left: 0;
}
.sidebar-wrapper
{
width: 200px;
}
.wrapper.toggled .sidebar-wrapper
{
width: 0;
}
.page-content-wrapper
{
padding: 20px;
position: relative;
}
.wrapper.toggled .page-content-wrapper
{
position: relative;
margin-right: 0;
}
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="wrapper">
<div class="sidebar-wrapper">
<br />
<!-- Side Bar -->
<div style="text-align: center;">
<br />
<ul class="sidebar-nav">
<li class="sidebar-brand">Aptest</li>
</ul>
<br />
<ul class="sidebar-nav">
<li><asp:LinkButton ID="Tview1" runat="server">Top Page</asp:LinkButton></li>
<li><asp:LinkButton ID="Tview2" runat="server">Index</asp:LinkButton></li>
<li><asp:LinkButton ID="Tview3" runat="server">iPhone 7</asp:LinkButton></li>
<li><asp:LinkButton ID="Tview4" runat="server">Page 4</asp:LinkButton></li>
<li><asp:LinkButton ID="Tview5" runat="server">Page 5</asp:LinkButton></li>
</ul>
</div>
<div class="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<section class="jumbotron">
<div class="container">
<div class="row text-center">
<h3>Click button for more!</h3>
<script>
$(document).ready(function () {
$(".wrapper").toggleClass("toggled");
});
</script>
<asp:Button ID="Top1" runat="server" Text="Button" OnClick="Top1_Click" />
</div>
</div>
</section>
</asp:View>
<asp:View ID="View2" runat="server">
<h1>1</h1>
</asp:View>
<asp:View ID="View3" runat="server">
<h1>2</h1>
</asp:View>
<asp:View ID="View4" runat="server">
<h1>3</h1>
</asp:View>
<asp:View ID="View5" runat="server">
<h1>4</h1>
</asp:View>
</asp:MultiView>
<br />
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
I don't know if I have done something wrong. Also I didn't know whether include the CSS/style in the code but it contains the code for the side bar.
The C# code is below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Top1_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
protected void Tview1_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
protected void Tview2_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
protected void Tview3_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 2;
}
protected void Tview4_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 3;
}
protected void Tview5_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 4;
}
}
I'm new to C# but I learnt online I think this it right.
This is all the page comes up with. It didn't do this before but now it does, I don't know why.

I think this might just be because the OnClick event is not present on the LinkButton. For example, change:
<li><asp:LinkButton ID="Tview3" runat="server">iPhone 7</asp:LinkButton></li>
to add:
OnClick="Tview3_Click"
so it becomes:
<li><asp:LinkButton ID="Tview3" runat="server" OnClick="Tview3_Click">iPhone 7</asp:LinkButton></li>

Related

Radio button align horizontally, but not vertically

My radio buttons align horizontally, but not vertically. I would like my radio buttons to line up with the length of my text. I don't know if it's because my css is placed in the wrong div.. here is my code for my cshtml view:
<h1 style="text-align:center"><b>INSPECTION DE TYPE HEBDOMADAIRE</b></h1>
<div class="container">
#{
int itemCounter = 0;
int camionCounter = 0;
}
#foreach (var camion in Model)
{
<br />
<h2 style="text-align:center">#camion.CamionNumero</h2>
<hr style="margin-bottom:0px; margin-top:0px" />
camionCounter++;
<table class="table">
<thead>
<tr>
<th>
<div>
#if (camion.composanteContent != null)
{
foreach (var composante in camion.composanteContent)
{
<h3><u>#composante.ComposanteName</u></h3>
if (composante.itemContent != null)
{
foreach (var item in composante.itemContent)
{
<div class="item-radio-comment-container">
<div style="font-size: 1.2em;" id="itemText_#(itemCounter)">· #item.ItemName</div>
<div class="radio">
<label>
<input type="radio" id="chkOK_#(itemCounter)" name="chkInventaire_#(camion.CamionNumero)_#(composante.ComposanteName)_#(item.ItemName)">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok-sign" color="green"></i></span>
Ok
</label>
<label>
<input type="radio" id="chkAVerif_#(itemCounter)" name="chkInventaire_#(camion.CamionNumero)_#(composante.ComposanteName)_#(item.ItemName)">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok-sign" color="darkorange"></i></span>
À Vérifier
</label>
</div>
<div style="display: inline-block; padding: 10px; display: none;" id="dvComment_#(itemCounter)">
<input type="text" class="form-control" style="width:20em;" id="txtComment_#(itemCounter)" placeholder="Veuillez entrer votre commentaire.." />
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#chkAVerif_#(itemCounter)").click(function () {
$("#dvComment_#(itemCounter)").show();
$('#itemText_#(itemCounter)').css('text-decoration', 'none');
});
$("#chkOK_#(itemCounter)").click(function () {
$("#dvComment_#(itemCounter)").hide();
$('#itemText_#(itemCounter)').css('text-decoration', 'line-through');
});
});
</script>
itemCounter++;
}
}
}
}
<hr />
</div>
</th>
</tr>
</thead>
</table>
}
Here is my css or did i try with item-radio-comment-container to make my radio button and my dvComment all align vertically so it is the same length relying on the text of the longest item while remaining on the same line horizontally :
html {
font-size: 14px;
}
#media (min-width: 768px) {
html {
font-size: 16px;
}
}
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
}
.checkbox label:after,
.radio label:after {
content: '';
display: table;
clear: both;
}
.checkbox .cr,
.radio .cr {
position: relative;
display: inline-block;
border: 1px solid #a9a9a9;
border-radius: .25em;
width: 1.3em;
height: 1.3em;
float: left;
margin-right: .5em;
}
.radio .cr {
border-radius: 50%;
}
.checkbox .cr .cr-icon,
.radio .cr .cr-icon {
position: absolute;
font-size: .8em;
line-height: 0;
top: 50%;
left: 20%;
}
.radio .cr .cr-icon {
margin-left: 0.04em;
}
.checkbox label input[type="checkbox"],
.radio label input[type="radio"] {
display: none;
}
.checkbox label input[type="checkbox"] + .cr > .cr-icon,
.radio label input[type="radio"] + .cr > .cr-icon {
transform: scale(3) rotateZ(-20deg);
opacity: 0;
transition: all .3s ease-in;
}
.checkbox label input[type="checkbox"]:checked + .cr > .cr-icon,
.radio label input[type="radio"]:checked + .cr > .cr-icon {
transform: scale(1) rotateZ(0deg);
opacity: 1;
}
.checkbox label input[type="checkbox"]:disabled + .cr,
.radio label input[type="radio"]:disabled + .cr {
opacity: .5;
}
.radio input[type="radio"] {
vertical-align: middle;
}
.item-radio-comment-container {
display: flex;
align-items: center;
}
#media (max-width: 767px) {
.item-radio-comment-container {
display: block;
}
}
And here is a picture of the result :

How to pass a controller's Id to SignalR

I am trying to create a real-time chat with a database. Without SignalR it works as it's supposed to. However, I want to add real-time functionality. The application queries the database for the MessageId, and then it lists all the messages with the MessageId. I passed the MessageId as a parameter into the url. and use that to look through the database, e.g. sever:messages/open/{MessageId}. But signalR is not getting to the controller's Id. if I just have _FC.UserMessage.ToList(); without any parameters, it works fine. I just need to know how can i use it with the controller's parameter.
Update: I just did more test and when i take away the variables in the site.js file, i.e. ${v.Date}, ${v.Message} the messages appear. However, only three appear from one account appear. So this is a real head-scratcher. It seems like the way I'm naming the variables is wrong since it throws me an Uncaught TypeError: Cannot read properties of null (reading 'Date') error. And now the problem with only displaying three messages. Now I'm thinking it has nothing to do with the controller parameters, but the naming of the variables. I thought I could name it v.UM.Date since public IEnumerable<UserMessageModel> UM {get; set;} is the name of the variable I have in the UserMessagesObj.cs view model. But that's throwing me the same error.
MessagesController:
using Flubr.Areas.Identity.Data;
using Flubr.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Flubr.Controllers
{
public class MessagesController : Controller
{
private readonly FlubrContext _FC;
private readonly UserManager<ApplicationUser> _UM;
private readonly IHubContext<SignalHub> _signal;
public MessagesController(FlubrContext FC, UserManager<ApplicationUser> UM, IHubContext<SignalHub> signal)
{
_FC = FC;
_UM = UM;
_signal = signal;
}
[HttpGet]
public IActionResult GetOpen(string id, UserMessagesObj umo)
{
var message = _FC.UserMessage.Include("applicationUser").Where(o => o.MessageId == id).Where(o => o.Message != "").ToList();
umo.UM = message;
return View(umo);
}
public IActionResult Open(string id, UserMessagesObj umo)
{
var message = _FC.UserMessage.Include("applicationUser").Where(o => o.MessageId == id).Where(o => o.Message != "").ToList();
umo.UM = message;
return View(umo);
}
[HttpPost]
public async Task<IActionResult> Open(string id, UserMessagesModel um, UserMessagesObj umo)
{
var message = _FC.UserMessage.Include("applicationUser").Where(o => o.MessageId == id).Where(o => o.Message != "").ToList();
Guid g = Guid.NewGuid();
umo.UM = message;
umo.UM2.UserMessageId = g;
umo.UM2.Id = _UM.GetUserAsync(User).Result.Id;
umo.UM2.MessageId = id;
umo.UM2.Date = DateTime.Now;
_FC.UserMessage.Add(umo.UM2);
await _FC.SaveChangesAsync();
await _signal.Clients.All.SendAsync("LoadData");
return View(umo);
}
}
}
Open.cshtml
#model UserMessagesObj
#using Microsoft.AspNetCore.Identity
#using Flubr.Areas.Identity.Data
#inject SignInManager<ApplicationUser> SignInManager
#inject UserManager<ApplicationUser> UserManager
<!DOCTYPE html>
<html lang="en">
<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">
<title>Document</title>
<link rel="stylesheet" href="sidebar.css">
<style>
* {
box-sizing: border-box;
}
body {
background-color: #abd9e9;
font-family: Arial;
}
#container {
width: 750px;
height: 800px;
background: #eff3f7;
margin: 0 auto;
font-size: 0;
border-radius: 5px;
overflow: hidden;
}
aside {
width: 260px;
height: 800px;
background-color: #3b3e49;
display: inline-block;
font-size: 15px;
vertical-align: top;
}
main {
width: 490px;
height: 800px;
display: inline-block;
font-size: 15px;
vertical-align: top;
}
aside header {
padding: 30px 20px;
}
aside input {
width: 100%;
height: 50px;
line-height: 50px;
padding: 0 50px 0 20px;
background-color: #5e616a;
border: none;
border-radius: 3px;
color: #fff;
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_search.png);
background-repeat: no-repeat;
background-position: 170px;
background-size: 40px;
}
aside input::placeholder {
color: #fff;
}
aside ul {
padding-left: 0;
margin: 0;
list-style-type: none;
overflow-y: scroll;
height: 690px;
}
aside li {
padding: 10px 0;
}
aside li:hover {
background-color: #5e616a;
}
h2,
h3 {
margin: 0;
}
aside li img {
border-radius: 50%;
margin-left: 20px;
margin-right: 8px;
}
aside li div {
display: inline-block;
vertical-align: top;
margin-top: 12px;
}
aside li h2 {
font-size: 14px;
color: #fff;
font-weight: normal;
margin-bottom: 5px;
}
aside li h3 {
font-size: 12px;
color: #7e818a;
font-weight: normal;
}
.status {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
margin-right: 7px;
}
.green {
background-color: #58b666;
}
.orange {
background-color: #ff725d;
}
.blue {
background-color: #6fbced;
margin-right: 0;
margin-left: 7px;
}
main header {
height: 110px;
padding: 30px 20px 30px 40px;
}
main header>* {
display: inline-block;
vertical-align: top;
}
main header img:first-child {
border-radius: 50%;
}
main header img:last-child {
width: 24px;
margin-top: 8px;
}
main header div {
margin-left: 10px;
margin-right: 145px;
}
main header h2 {
font-size: 16px;
margin-bottom: 5px;
}
main header h3 {
font-size: 14px;
font-weight: normal;
color: #7e818a;
}
#chat {
padding-left: 0;
margin: 0;
list-style-type: none;
overflow-y: scroll;
height: 535px;
border-top: 2px solid #fff;
border-bottom: 2px solid #fff;
}
#chat li {
padding: 10px 30px;
}
#chat h2,
#chat h3 {
display: inline-block;
font-size: 13px;
font-weight: normal;
}
#chat h3 {
color: #bbb;
}
#chat .entete {
margin-bottom: 5px;
}
#chat .message {
padding: 20px;
color: #fff;
line-height: 25px;
max-width: 90%;
display: inline-block;
text-align: left;
border-radius: 5px;
}
#chat .me {
text-align: right;
}
#chat .you .message {
background-color: #58b666;
}
#chat .me .message {
background-color: #6fbced;
}
#chat .triangle {
width: 0;
height: 0;
border-style: solid;
border-width: 0 10px 10px 10px;
}
#chat .you .triangle {
border-color: transparent transparent #58b666 transparent;
margin-left: 15px;
}
#chat .me .triangle {
border-color: transparent transparent #6fbced transparent;
margin-left: 375px;
}
main footer {
height: 155px;
padding: 20px 30px 10px 20px;
}
main footer textarea {
resize: none;
border: none;
display: block;
width: 100%;
height: 80px;
border-radius: 3px;
padding: 20px;
font-size: 13px;
margin-bottom: 13px;
}
main footer textarea::placeholder {
color: #ddd;
}
main footer img {
height: 30px;
cursor: pointer;
}
main footer a {
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
color: #6fbced;
vertical-align: top;
margin-left: 333px;
margin-top: 5px;
display: inline-block;
}
</style>
</head>
<body>
<div id="container">
<aside>
<header>
</header>
<ul>
<li>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/chat_avatar_01.jpg" alt="">
<div>
<h2>Prénom Nom</h2>
<h3>
<span class="status orange"></span>
offline
</h3>
</div>
</li>
</ul>
</aside>
<main>
<header>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/chat_avatar_01.jpg" alt="">
<div>
<h2>Chat with </h2>
<h3>already 1902 messages</h3>
</div>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_star.png" alt="">
</header>
<ul id="chat"> </ul>
<footer>
<form method ="post" asp-controller="Messages" asp-action="Open" >
<textarea asp-for="#Model.UM2.Message" placeholder="Type your message"></textarea>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_picture.png" alt="">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_file.png" alt="">
<button type="submit" class="btn" style="float: right;">Send</button>
</form>
</footer>
</main>
</div>
</body>
</html>
site.js
#model UserMessagesObj
#using Microsoft.AspNetCore.Identity
#using Flubr.Areas.Identity.Data
#inject SignInManager<ApplicationUser> SignInManager
#inject UserManager<ApplicationUser> UserManager
<!DOCTYPE html>
<html lang="en">
<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">
<title>Document</title>
<link rel="stylesheet" href="sidebar.css">
<style>
* {
box-sizing: border-box;
}
body {
background-color: #abd9e9;
font-family: Arial;
}
#container {
width: 750px;
height: 800px;
background: #eff3f7;
margin: 0 auto;
font-size: 0;
border-radius: 5px;
overflow: hidden;
}
aside {
width: 260px;
height: 800px;
background-color: #3b3e49;
display: inline-block;
font-size: 15px;
vertical-align: top;
}
main {
width: 490px;
height: 800px;
display: inline-block;
font-size: 15px;
vertical-align: top;
}
aside header {
padding: 30px 20px;
}
aside input {
width: 100%;
height: 50px;
line-height: 50px;
padding: 0 50px 0 20px;
background-color: #5e616a;
border: none;
border-radius: 3px;
color: #fff;
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_search.png);
background-repeat: no-repeat;
background-position: 170px;
background-size: 40px;
}
aside input::placeholder {
color: #fff;
}
aside ul {
padding-left: 0;
margin: 0;
list-style-type: none;
overflow-y: scroll;
height: 690px;
}
aside li {
padding: 10px 0;
}
aside li:hover {
background-color: #5e616a;
}
h2,
h3 {
margin: 0;
}
aside li img {
border-radius: 50%;
margin-left: 20px;
margin-right: 8px;
}
aside li div {
display: inline-block;
vertical-align: top;
margin-top: 12px;
}
aside li h2 {
font-size: 14px;
color: #fff;
font-weight: normal;
margin-bottom: 5px;
}
aside li h3 {
font-size: 12px;
color: #7e818a;
font-weight: normal;
}
.status {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
margin-right: 7px;
}
.green {
background-color: #58b666;
}
.orange {
background-color: #ff725d;
}
.blue {
background-color: #6fbced;
margin-right: 0;
margin-left: 7px;
}
main header {
height: 110px;
padding: 30px 20px 30px 40px;
}
main header>* {
display: inline-block;
vertical-align: top;
}
main header img:first-child {
border-radius: 50%;
}
main header img:last-child {
width: 24px;
margin-top: 8px;
}
main header div {
margin-left: 10px;
margin-right: 145px;
}
main header h2 {
font-size: 16px;
margin-bottom: 5px;
}
main header h3 {
font-size: 14px;
font-weight: normal;
color: #7e818a;
}
#chat {
padding-left: 0;
margin: 0;
list-style-type: none;
overflow-y: scroll;
height: 535px;
border-top: 2px solid #fff;
border-bottom: 2px solid #fff;
}
#chat li {
padding: 10px 30px;
}
#chat h2,
#chat h3 {
display: inline-block;
font-size: 13px;
font-weight: normal;
}
#chat h3 {
color: #bbb;
}
#chat .entete {
margin-bottom: 5px;
}
#chat .message {
padding: 20px;
color: #fff;
line-height: 25px;
max-width: 90%;
display: inline-block;
text-align: left;
border-radius: 5px;
}
#chat .me {
text-align: right;
}
#chat .you .message {
background-color: #58b666;
}
#chat .me .message {
background-color: #6fbced;
}
#chat .triangle {
width: 0;
height: 0;
border-style: solid;
border-width: 0 10px 10px 10px;
}
#chat .you .triangle {
border-color: transparent transparent #58b666 transparent;
margin-left: 15px;
}
#chat .me .triangle {
border-color: transparent transparent #6fbced transparent;
margin-left: 375px;
}
main footer {
height: 155px;
padding: 20px 30px 10px 20px;
}
main footer textarea {
resize: none;
border: none;
display: block;
width: 100%;
height: 80px;
border-radius: 3px;
padding: 20px;
font-size: 13px;
margin-bottom: 13px;
}
main footer textarea::placeholder {
color: #ddd;
}
main footer img {
height: 30px;
cursor: pointer;
}
main footer a {
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
color: #6fbced;
vertical-align: top;
margin-left: 333px;
margin-top: 5px;
display: inline-block;
}
</style>
</head>
<body>
<div id="container">
<aside>
<header>
</header>
<ul>
<li>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/chat_avatar_01.jpg" alt="">
<div>
<h2>Prénom Nom</h2>
<h3>
<span class="status orange"></span>
offline
</h3>
</div>
</li>
</ul>
</aside>
<main>
<header>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/chat_avatar_01.jpg" alt="">
<div>
<h2>Chat with </h2>
<h3>already 1902 messages</h3>
</div>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_star.png" alt="">
</header>
<ul id="chat"> </ul>
<footer>
<form method ="post" asp-controller="Messages" asp-action="Open" >
<textarea asp-for="#Model.UM2.Message" placeholder="Type your message"></textarea>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_picture.png" alt="">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_file.png" alt="">
<button type="submit" class="btn" style="float: right;">Send</button>
</form>
</footer>
</main>
</div>
</body>
</html>
SignalHub.cs
#model UserMessagesObj
#using Microsoft.AspNetCore.Identity
#using Flubr.Areas.Identity.Data
#inject SignInManager<ApplicationUser> SignInManager
#inject UserManager<ApplicationUser> UserManager
<!DOCTYPE html>
<html lang="en">
<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">
<title>Document</title>
<link rel="stylesheet" href="sidebar.css">
<style>
* {
box-sizing: border-box;
}
body {
background-color: #abd9e9;
font-family: Arial;
}
#container {
width: 750px;
height: 800px;
background: #eff3f7;
margin: 0 auto;
font-size: 0;
border-radius: 5px;
overflow: hidden;
}
aside {
width: 260px;
height: 800px;
background-color: #3b3e49;
display: inline-block;
font-size: 15px;
vertical-align: top;
}
main {
width: 490px;
height: 800px;
display: inline-block;
font-size: 15px;
vertical-align: top;
}
aside header {
padding: 30px 20px;
}
aside input {
width: 100%;
height: 50px;
line-height: 50px;
padding: 0 50px 0 20px;
background-color: #5e616a;
border: none;
border-radius: 3px;
color: #fff;
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_search.png);
background-repeat: no-repeat;
background-position: 170px;
background-size: 40px;
}
aside input::placeholder {
color: #fff;
}
aside ul {
padding-left: 0;
margin: 0;
list-style-type: none;
overflow-y: scroll;
height: 690px;
}
aside li {
padding: 10px 0;
}
aside li:hover {
background-color: #5e616a;
}
h2,
h3 {
margin: 0;
}
aside li img {
border-radius: 50%;
margin-left: 20px;
margin-right: 8px;
}
aside li div {
display: inline-block;
vertical-align: top;
margin-top: 12px;
}
aside li h2 {
font-size: 14px;
color: #fff;
font-weight: normal;
margin-bottom: 5px;
}
aside li h3 {
font-size: 12px;
color: #7e818a;
font-weight: normal;
}
.status {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
margin-right: 7px;
}
.green {
background-color: #58b666;
}
.orange {
background-color: #ff725d;
}
.blue {
background-color: #6fbced;
margin-right: 0;
margin-left: 7px;
}
main header {
height: 110px;
padding: 30px 20px 30px 40px;
}
main header>* {
display: inline-block;
vertical-align: top;
}
main header img:first-child {
border-radius: 50%;
}
main header img:last-child {
width: 24px;
margin-top: 8px;
}
main header div {
margin-left: 10px;
margin-right: 145px;
}
main header h2 {
font-size: 16px;
margin-bottom: 5px;
}
main header h3 {
font-size: 14px;
font-weight: normal;
color: #7e818a;
}
#chat {
padding-left: 0;
margin: 0;
list-style-type: none;
overflow-y: scroll;
height: 535px;
border-top: 2px solid #fff;
border-bottom: 2px solid #fff;
}
#chat li {
padding: 10px 30px;
}
#chat h2,
#chat h3 {
display: inline-block;
font-size: 13px;
font-weight: normal;
}
#chat h3 {
color: #bbb;
}
#chat .entete {
margin-bottom: 5px;
}
#chat .message {
padding: 20px;
color: #fff;
line-height: 25px;
max-width: 90%;
display: inline-block;
text-align: left;
border-radius: 5px;
}
#chat .me {
text-align: right;
}
#chat .you .message {
background-color: #58b666;
}
#chat .me .message {
background-color: #6fbced;
}
#chat .triangle {
width: 0;
height: 0;
border-style: solid;
border-width: 0 10px 10px 10px;
}
#chat .you .triangle {
border-color: transparent transparent #58b666 transparent;
margin-left: 15px;
}
#chat .me .triangle {
border-color: transparent transparent #6fbced transparent;
margin-left: 375px;
}
main footer {
height: 155px;
padding: 20px 30px 10px 20px;
}
main footer textarea {
resize: none;
border: none;
display: block;
width: 100%;
height: 80px;
border-radius: 3px;
padding: 20px;
font-size: 13px;
margin-bottom: 13px;
}
main footer textarea::placeholder {
color: #ddd;
}
main footer img {
height: 30px;
cursor: pointer;
}
main footer a {
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
color: #6fbced;
vertical-align: top;
margin-left: 333px;
margin-top: 5px;
display: inline-block;
}
</style>
</head>
<body>
<div id="container">
<aside>
<header>
</header>
<ul>
<li>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/chat_avatar_01.jpg" alt="">
<div>
<h2>Prénom Nom</h2>
<h3>
<span class="status orange"></span>
offline
</h3>
</div>
</li>
</ul>
</aside>
<main>
<header>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/chat_avatar_01.jpg" alt="">
<div>
<h2>Chat with </h2>
<h3>already 1902 messages</h3>
</div>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_star.png" alt="">
</header>
<ul id="chat"> </ul>
<footer>
<form method ="post" asp-controller="Messages" asp-action="Open" >
<textarea asp-for="#Model.UM2.Message" placeholder="Type your message"></textarea>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_picture.png" alt="">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1940306/ico_file.png" alt="">
<button type="submit" class="btn" style="float: right;">Send</button>
</form>
</footer>
</main>
</div>
</body>
</html>
StartUp.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Flubr
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddSignalR();
services.AddControllers().AddJsonOptions(o => {
o.JsonSerializerOptions.PropertyNamingPolicy = null;
});
services.AddRazorPages();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapRazorPages();
endpoints.MapHub<SignalHub>("/SignalHub");
});
}
}
}
UserMessagesObj.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Flubr.Models
{
public class UserMessagesObj
{
public IEnumerable<UserMessagesModel> UM { get; set; }
public UserMessagesModel UM2 { get; set; }
public MessagesModel MM { get; set; }
}
}

setting div to row but nothing happens

I am trying to make the three items in the top_three div to be displayed in a row but when I set it to row nothing happens, but if I set the .scoreboard to row then I get the row, but I don't want the .restplaces div to be in a row I want it to be displayed underneath, I really don't understand why it's not working.
I use a css file with a Razor component:
Razor component:
#if (Teams is not null)
{
<div class="confetti_container">
<div class="confetti"></div>
**(There are like 20 more of this div but i don't wanna clutter this here)**
</div>
<div class="scoreboard">
#do
{
_place++;
var allteams = Teams.Where(team => team.TeamPoints ==
Teams[0].TeamPoints).ToList();
foreach (var team in allteams)
{
<div class="top_three">
#if (_place == 2)
{
<div class="secondplace">
<div class="secondplaceimg"></div>
<h1>#team.TeamName</h1>
</div>
}
#if (_place == 1)
{
<div class="firstplace">
<div class="firstplaceimg"></div>
<h1>#team.TeamName</h1>
</div>
}
#if (_place == 3)
{
<div class="thirdplace">
<div class="thirdplaceimg"></div>
<h1>#team.TeamName</h1>
</div>
}
</div>
#if (_place > 3)
{
<div class="restplaces">
<p>#_place. #team.TeamName</p>
</div>
}
Teams.Remove(team);
}
if (Teams.Count == 0)
{
_scoreboardCreated = true;
}
} while (_scoreboardCreated == false);
</div>
}
else if (_deleted is true)
{
<h1>Session expired</h1>
}
else
{
<h1>Loading...</h1>
}
And here the CSS-file (I use a div with a background-image because the img htmltag just doesn't seem to load the image).
.scoreboard {
display:flex;
flex-direction: column;
text-align: center;
align-items: center;
}
.top_three {
display: flex;
flex-direction: row;
justify-content: center;
align-content: center;
}
.firstplace {
padding: 8vh 5vw 5vh 5vw;
}
.firstplaceimg {
background-image: url("/images/Firstplace.png");
height: 340px;
width: 315px;
}
.secondplace {
padding: 15vh 5vw 5vh 5vw;
}
.secondplaceimg {
background-image: url("/images/Secondplace.png");
height: 270px;
width: 250px;
}
.thirdplace {
padding: 28vh 5vw 8vh 5vw;
}
.thirdplaceimg {
background-image: url("/images/Thirdplace.png");
height: 170px;
width: 155px;
}
.restplaces {
display:flex;
margin: 0vh 0vw 5vh 3vw;
background-color: #bd8379;
width: 10vw;
border-radius: 20px;
box-shadow: 0 0 5px 2px rgba(0,0,0, .30);
}
/*CONFETTI*/
.confetti_container {
min-height: 70vh;
overflow: hidden;
padding: 60px;
position: absolute;
width: 95%;
}
.confetti {
background: rgb(166,124,0);
background: linear-gradient(0deg, rgba(166,124,0,1) 0%, rgba(191,155,48,1) 10%,
rgba(255,191,0,1) 20%, rgba(255,207,64,1) 30%, rgba(255,220,115,1) 40%,
rgba(255,216,99,1)
50%, rgba(255,220,115,1) 60%, rgba(255,207,64,1) 70%, rgba(255,191,0,1) 80%,
rgba(191,155,48,1) 90%, rgba(166,124,0,1) 100%);
border: 1px solid #A57C01;
position: absolute;
display: flex;
width: 10px;
height: 25px;
top: -100px;
}
.confetti:nth-child(1) {
animation: fall 2.5s linear infinite;
left: 10%;
}
It feels like I'm just missing a tiny detail
Thanks for the help!
You can try to use display: inline-block; to make the divs in one row,change the css of scoreboard and top_three like this:
.scoreboard {
flex-direction: column;
text-align: center;
align-items: center;
}
.top_three {
display: inline-block;
flex-direction: row;
justify-content: center;
align-content: center;
}
result:

How can I handling with nested data-parent

I want to do a Menu with 3 levels using data-parents do close like that:
Menu1
---SubMenu1
------Sub_SubMenu1
------Sub_SubMenu2
---SubMenu2
Menu2
---SubMenu22
------Sub_SubMenu21
------Sub_SubMenu22
---SubMenu22
So I have the following sample code (not with full menu):
<div id="Menu1">
<button data-toggle="collapse" data-target="#div1">
Menu1
</button>
<div id="div1" data-parent="Menu1">
<div id="SubMenu1">
<button data-toggle="collapse" data-target="#div1">
SubMenu1
</button>
<div id="submenu1"></div>
<button data-toggle="collapse" data-target="#submenu2">
SubMenu2
</button>
<div id="submenu2"></div>
</div>
</div>
</div>
My problem is when I open any SubSubMenu And after I open a Menu , SubSubMenu isn't closed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sidebar Menu Example</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
</head>
<style>
.animate-menu-push {
left: 0;
position: relative;
transition: all 0.3s ease; }
.animate-menu-push.animate-menu-push-right {
left: 200px; }
.animate-menu-push.animate-menu-push-left {
left: -200px; }
.animate-menu {
position: fixed;
top: 0;
width: 200px;
height: 100%;
transition: all 0.3s ease; }
.animate-menu-left {
left: -200px; }
.animate-menu-left.animate-menu-open {
left: 0; }
.animate-menu-right {
right: -200px; }
.animate-menu-right.animate-menu-open {
right: 0; }
.sidebar-menu {
list-style: none;
margin: 0;
padding: 0;
background-color: #222d32; }
.sidebar-menu > li {
position: relative;
margin: 0;
padding: 0; }
.sidebar-menu > li > a {
padding: 12px 5px 12px 15px;
display: block;
border-left: 3px solid transparent;
color: #b8c7ce; }
.sidebar-menu > li > a > .fa {
width: 20px; }
.sidebar-menu > li:hover > a, .sidebar-menu > li.active > a {
color: #fff;
background: #1e282c;
border-left-color: #3c8dbc; }
.sidebar-menu > li .label,
.sidebar-menu > li .badge {
margin-top: 3px;
margin-right: 5px; }
.sidebar-menu li.sidebar-header {
padding: 10px 25px 10px 15px;
font-size: 12px;
color: #4b646f;
background: #1a2226; }
.sidebar-menu li > a > .fa-angle-left {
width: auto;
height: auto;
padding: 0;
margin-right: 10px;
margin-top: 3px; }
.sidebar-menu li.active > a > .fa-angle-left {
transform: rotate(-90deg); }
.sidebar-menu li.active > .sidebar-submenu {
display: block; }
.sidebar-menu a {
color: #b8c7ce;
text-decoration: none; }
.sidebar-menu .sidebar-submenu {
display: none;
list-style: none;
padding-left: 5px;
margin: 0 1px;
background: #2c3b41; }
.sidebar-menu .sidebar-submenu .sidebar-submenu {
padding-left: 20px; }
.sidebar-menu .sidebar-submenu > li > a {
padding: 5px 5px 5px 15px;
display: block;
font-size: 14px;
color: #8aa4af; }
.sidebar-menu .sidebar-submenu > li > a > .fa {
width: 20px; }
.sidebar-menu .sidebar-submenu > li > a > .fa-angle-left,
.sidebar-menu .sidebar-submenu > li > a > .fa-angle-down {
width: auto; }
.sidebar-menu .sidebar-submenu > li.active > a, .sidebar-menu .sidebar-submenu > li > a:hover {
color: #fff; }
.sidebar-menu-rtl {
list-style: none;
margin: 0;
padding: 0;
background-color: #222d32; }
.sidebar-menu-rtl > li {
position: relative;
margin: 0;
padding: 0; }
.sidebar-menu-rtl > li > a {
padding: 12px 15px 12px 5px;
display: block;
border-left: 3px solid transparent;
color: #b8c7ce; }
.sidebar-menu-rtl > li > a > .fa {
width: 20px; }
.sidebar-menu-rtl > li:hover > a, .sidebar-menu-rtl > li.active > a {
color: #fff;
background: #1e282c;
border-left-color: #3c8dbc; }
.sidebar-menu-rtl > li .label,
.sidebar-menu-rtl > li .badge {
margin-top: 3px;
margin-right: 5px; }
.sidebar-menu-rtl li.sidebar-header {
padding: 10px 15px 10px 25px;
font-size: 12px;
color: #4b646f;
background: #1a2226; }
.sidebar-menu-rtl li > a > .fa-angle-left {
width: auto;
height: auto;
padding: 0;
margin-right: 10px;
margin-top: 3px; }
.sidebar-menu-rtl li.active > a > .fa-angle-left {
transform: rotate(-90deg); }
.sidebar-menu-rtl li.active > .sidebar-submenu {
display: block; }
.sidebar-menu-rtl a {
color: #b8c7ce;
text-decoration: none; }
.sidebar-menu-rtl .sidebar-submenu {
display: none;
list-style: none;
padding-right: 5px;
margin: 0 1px;
background: #2c3b41; }
.sidebar-menu-rtl .sidebar-submenu .sidebar-submenu {
padding-right: 20px; }
.sidebar-menu-rtl .sidebar-submenu > li > a {
padding: 5px 15px 5px 5px;
display: block;
font-size: 14px;
color: #8aa4af; }
.sidebar-menu-rtl .sidebar-submenu > li > a > .fa {
width: 20px; }
.sidebar-menu-rtl .sidebar-submenu > li > a > .fa-angle-left,
.sidebar-menu-rtl .sidebar-submenu > li > a > .fa-angle-down {
width: auto; }
.sidebar-menu-rtl .sidebar-submenu > li.active > a, .sidebar-menu-rtl .sidebar-submenu > li > a:hover {
color: #fff; }
</style>
<body>
<section style="width: 200px">
<ul class="sidebar-menu">
<li class="sidebar-header">MAIN NAVIGATION</li>
<li>
<a href="#">
<i class="fa fa-dashboard"></i> <span>Dashboard</span> <i class="fa fa-angle-left pull-right"></i>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-share"></i> <span>Multilevel</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="sidebar-submenu">
<li><i class="fa fa-circle-o"></i> Level One</li>
<li>
<i class="fa fa-circle-o"></i> Level One <i class="fa fa-angle-left pull-right"></i>
<ul class="sidebar-submenu">
<li><i class="fa fa-circle-o"></i> Level Two</li>
<li>
<i class="fa fa-circle-o"></i> Level Two <i class="fa fa-angle-left pull-right"></i>
<ul class="sidebar-submenu">
<li><i class="fa fa-circle-o"></i> Level Three</li>
<li><i class="fa fa-circle-o"></i> Level Three</li>
</ul>
</li>
</ul>
</li>
<li><i class="fa fa-circle-o"></i> Level One</li>
</ul>
</li>
</ul>
</section>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script>
$.sidebarMenu = function(menu) {
var animationSpeed = 300,
subMenuSelector = '.sidebar-submenu';
$(menu).on('click', 'li a', function(e) {
var $this = $(this);
var checkElement = $this.next();
if (checkElement.is(subMenuSelector) && checkElement.is(':visible')) {
checkElement.slideUp(animationSpeed, function() {
checkElement.removeClass('menu-open');
});
checkElement.parent("li").removeClass("active");
}
//If the menu is not visible
else if ((checkElement.is(subMenuSelector)) && (!checkElement.is(':visible'))) {
//Get the parent menu
var parent = $this.parents('ul').first();
//Close all open menus within the parent
var ul = parent.find('ul:visible').slideUp(animationSpeed);
//Remove the menu-open class from the parent
ul.removeClass('menu-open');
//Get the parent li
var parent_li = $this.parent("li");
//Open the target menu and add the menu-open class
checkElement.slideDown(animationSpeed, function() {
//Add the class active to the parent li
checkElement.addClass('menu-open');
parent.find('li.active').removeClass('active');
parent_li.addClass('active');
});
}
//if this isn't a link, prevent the page from being redirected
if (checkElement.is(subMenuSelector)) {
e.preventDefault();
}
});
}
$.sidebarMenu($('.sidebar-menu'))
</script>
</body>
</html>
If you want to test it in the "Code snippet" will appear exactly as it appears on smart phones, but the appearance will vary completely on the desktop
$("#cssmenu").menumaker({
title: "Menu",
breakpoint: 768,
format: "multitoggle"
});
#import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);
#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a,
#cssmenu #menu-button {
margin: 0;
padding: 0;
border: 0;
list-style: none;
line-height: 1;
display: block;
position: relative;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#cssmenu:after,
#cssmenu > ul:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
#cssmenu #menu-button {
display: none;
}
#cssmenu {
font-family: Montserrat, sans-serif;
background: #333333;
}
#cssmenu > ul > li {
float: left;
}
#cssmenu.align-center > ul {
font-size: 0;
text-align: center;
}
#cssmenu.align-center > ul > li {
display: inline-block;
float: none;
}
#cssmenu.align-center ul ul {
text-align: left;
}
#cssmenu.align-right > ul > li {
float: right;
}
#cssmenu > ul > li > a {
padding: 17px;
font-size: 12px;
letter-spacing: 1px;
text-decoration: none;
color: #dddddd;
font-weight: 700;
text-transform: uppercase;
}
#cssmenu > ul > li:hover > a {
color: #ffffff;
}
#cssmenu > ul > li.has-sub > a {
padding-right: 30px;
}
#cssmenu > ul > li.has-sub > a:after {
position: absolute;
top: 22px;
right: 11px;
width: 8px;
height: 2px;
display: block;
background: #dddddd;
content: '';
}
#cssmenu > ul > li.has-sub > a:before {
position: absolute;
top: 19px;
right: 14px;
display: block;
width: 2px;
height: 8px;
background: #dddddd;
content: '';
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
#cssmenu > ul > li.has-sub:hover > a:before {
top: 23px;
height: 0;
}
#cssmenu ul ul {
position: absolute;
left: -9999px;
}
#cssmenu.align-right ul ul {
text-align: right;
}
#cssmenu ul ul li {
height: 0;
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
#cssmenu li:hover > ul {
left: auto;
}
#cssmenu.align-right li:hover > ul {
left: auto;
right: 0;
}
#cssmenu li:hover > ul > li {
height: 35px;
}
#cssmenu ul ul ul {
margin-left: 100%;
top: 0;
}
#cssmenu.align-right ul ul ul {
margin-left: 0;
margin-right: 100%;
}
#cssmenu ul ul li a {
border-bottom: 1px solid rgba(150, 150, 150, 0.15);
padding: 11px 15px;
width: 170px;
font-size: 12px;
text-decoration: none;
color: #dddddd;
font-weight: 400;
background: #333333;
}
#cssmenu ul ul li:last-child > a,
#cssmenu ul ul li.last-item > a {
border-bottom: 0;
}
#cssmenu ul ul li:hover > a,
#cssmenu ul ul li a:hover {
color: #ffffff;
}
#cssmenu ul ul li.has-sub > a:after {
position: absolute;
top: 16px;
right: 11px;
width: 8px;
height: 2px;
display: block;
background: #dddddd;
content: '';
}
#cssmenu.align-right ul ul li.has-sub > a:after {
right: auto;
left: 11px;
}
#cssmenu ul ul li.has-sub > a:before {
position: absolute;
top: 13px;
right: 14px;
display: block;
width: 2px;
height: 8px;
background: #dddddd;
content: '';
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
#cssmenu.align-right ul ul li.has-sub > a:before {
right: auto;
left: 14px;
}
#cssmenu ul ul > li.has-sub:hover > a:before {
top: 17px;
height: 0;
}
#cssmenu.small-screen {
width: 100%;
}
#cssmenu.small-screen ul {
width: 100%;
display: none;
}
#cssmenu.small-screen.align-center > ul {
text-align: left;
}
#cssmenu.small-screen ul li {
width: 100%;
border-top: 1px solid rgba(120, 120, 120, 0.2);
}
#cssmenu.small-screen ul ul li,
#cssmenu.small-screen li:hover > ul > li {
height: auto;
}
#cssmenu.small-screen ul li a,
#cssmenu.small-screen ul ul li a {
width: 100%;
border-bottom: 0;
}
#cssmenu.small-screen > ul > li {
float: none;
}
#cssmenu.small-screen ul ul li a {
padding-left: 25px;
}
#cssmenu.small-screen ul ul ul li a {
padding-left: 35px;
}
#cssmenu.small-screen ul ul li a {
color: #dddddd;
background: none;
}
#cssmenu.small-screen ul ul li:hover > a,
#cssmenu.small-screen ul ul li.active > a {
color: #ffffff;
}
#cssmenu.small-screen ul ul,
#cssmenu.small-screen ul ul ul,
#cssmenu.small-screen.align-right ul ul {
position: relative;
left: 0;
width: 100%;
margin: 0;
text-align: left;
}
#cssmenu.small-screen > ul > li.has-sub > a:after,
#cssmenu.small-screen > ul > li.has-sub > a:before,
#cssmenu.small-screen ul ul > li.has-sub > a:after,
#cssmenu.small-screen ul ul > li.has-sub > a:before {
display: none;
}
#cssmenu.small-screen #menu-button {
display: block;
padding: 17px;
color: #dddddd;
cursor: pointer;
font-size: 12px;
text-transform: uppercase;
font-weight: 700;
}
#cssmenu.small-screen #menu-button:after {
position: absolute;
top: 22px;
right: 17px;
display: block;
height: 4px;
width: 20px;
border-top: 2px solid #dddddd;
border-bottom: 2px solid #dddddd;
content: '';
box-sizing: content-box;
}
#cssmenu.small-screen #menu-button:before {
position: absolute;
top: 16px;
right: 17px;
display: block;
height: 2px;
width: 20px;
background: #dddddd;
content: '';
box-sizing: content-box;
}
#cssmenu.small-screen #menu-button.menu-opened:after {
top: 23px;
border: 0;
height: 2px;
width: 15px;
background: #ffffff;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
#cssmenu.small-screen #menu-button.menu-opened:before {
top: 23px;
background: #ffffff;
width: 15px;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
}
#cssmenu.small-screen .submenu-button {
position: absolute;
z-index: 99;
right: 0;
top: 0;
display: block;
border-left: 1px solid rgba(120, 120, 120, 0.2);
height: 46px;
width: 46px;
cursor: pointer;
}
#cssmenu.small-screen .submenu-button.submenu-opened {
background: #262626;
}
#cssmenu.small-screen ul ul .submenu-button {
height: 34px;
width: 34px;
}
#cssmenu.small-screen .submenu-button:after {
position: absolute;
top: 22px;
right: 19px;
width: 8px;
height: 2px;
display: block;
background: #dddddd;
content: '';
}
#cssmenu.small-screen ul ul .submenu-button:after {
top: 15px;
right: 13px;
}
#cssmenu.small-screen .submenu-button.submenu-opened:after {
background: #ffffff;
}
#cssmenu.small-screen .submenu-button:before {
position: absolute;
top: 19px;
right: 22px;
display: block;
width: 2px;
height: 8px;
background: #dddddd;
content: '';
}
#cssmenu.small-screen ul ul .submenu-button:before {
top: 12px;
right: 16px;
}
#cssmenu.small-screen .submenu-button.submenu-opened:before {
display: none;
}
#cssmenu.small-screen.select-list {
padding: 5px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- jQuery -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<!-- MenuMaker Plugin -->
<script src="https://s3.amazonaws.com/menumaker/menumaker.min.js"></script>
<!-- Icon Library -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<title>Test</title>
</head>
<body>
<div id="cssmenu">
<ul>
<li><i class="fa fa-fw fa-home"></i> Home</li>
<li><i class="fa fa-fw fa-bars"></i> Menus
<ul>
<li>Menu 1
<ul>
<li>Sub menu 1.1
<ul>
<li>Sub_SubMenu 1.1.1</li>
<li>Sub_SubMenu 1.1.2</li>
</ul>
</li>
<li>Sub menu 1.2</li>
</ul>
</li>
<li>Menu 2
<ul>
<li>Sub menu 2.1
<ul>
<li>Sub_SubMenu 2.1.1</li>
<li>Sub_SubMenu 2.1.2</li>
</ul>
</li>
<li>Sub menu 2.2</li>
</ul>
</li>
</ul>
</li>
<li><i class="fa fa-fw fa-cog"></i> Settings</li>
<li><i class="fa fa-fw fa-phone"></i> Contact</li>
</ul>
</div>
</body>
</html>

I have converted static menu code to dynamic menu code

I have converted static code to dynamic my static is working well but in dynamic mouser-hover effect has stop working when I do mouse hover it will show me sub menu.
<head runat="server">
<title></title>
<style>
ul
{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #428bca;
}
li
{
float: left;
}
li a, .dropbtn
{
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn
{
background-color: inherit;
}
li.dropdown
{
display: inline-block;
}
.dropdown-content
{
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a
{
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover
{
background-color: #f1f1f1;
}
.dropdown:hover .dropdown-content
{
display: block;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<ul>
<li class="dropdown">MY ARTICLES
<div class="dropdown-content">
Aapnu Surat ચોકલેટી અભિનેતા વિનોદ મેહરા <a href="#">
ઋષિસમાન સંગીતકાર સચિનદેવ બર્મન</a>
</div>
</li>
<li class="dropdown">MY PRESENTATIONS
<div class="dropdown-content">
Safaltani Sargam Part I Safaltani Sargam Part II
The Art Of Illusion <a href="#">100 Years Of Indian Cinema - Part I
Silent Film Era</a>
</div>
</li>
<li class="dropdown">DRAMA
<div class="dropdown-content">
Result Of SMC Drama Contest RESULTS OF 39th SMC DRAMA CONTEST
The Result Of SMC Drama Contest 2012 An Enemy Of The People
</div>
</div> </li>
<li class="dropdown">GUJARAT
<div class="dropdown-content">
Link 1વી ધ પીપલ ઓફ ગુજરાત
</li>
<li class="dropdown">INDIAN CULTURE
<div class="dropdown-content">
The Vedic Culture - Guj
</div>
</li>
</ul>
</form>
</body>
</html>
Select all
Open in new window
this is for static
<style>
/* ul */
.submenu
{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #428bca;
}
.submenu li
{
float: left;
}
.submenu li a, .dropbtn
{
display: inline-block;
color: white;
text-align: center;
padding: 12px 36px;
text-decoration: none;
}
.submenu li a:hover, .dropdown:hover .dropbtn
{
background-color: inherit;
}
.submenu li.dropdown
{
display: inline-block;
}
.submenu .dropdown-content
{
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.submenu .dropdown-content a
{
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.submenu .dropdown-content a:hover
{
background-color: #f1f1f1;
}
.submenu .dropdown:hover .submenu .dropdown-content
{
display: block;
}
</style>
<div class="Container">
<ul class="submenu" id="topicmenu" runat="server">
</ul>
</div>
private void fillMenu()
{
clsTopic objTopic = new clsTopic(true);
objTopic.SelectAll();
string str = string.Empty;
int i = 0;
for (i = 0; i < objTopic.ListclsTopic.Count; i++)
{
str +=#"<li class='dropdown'><a href='#' class='dropbtn' style='text-transform:uppercase;'>"+ objTopic.ListclsTopic[i].TopicName+#"</a></li>";
}
topicmenu.InnerHtml = str;
}
I want to convert it to dynamic coding I have converted it but when I do hover on menu I don't find sub menu.

Categories