How to create dynamic submenus of submenu? - c#

<ul>
<li>HOME</li>
<li>Career
<ul>
<asp:Repeater ID="_rptSubMenu" runat="server">
<ItemTemplate>
<li><a href="#" ><%# Eval("career") %></a></li>
</ItemTemplate>
</asp:Repeater>
</ul>
</li>
<li>Contact us</li>
</ul>
This is creating dynamic submenus . I want submenus under career like asp.net php etc from database. How to do?

Related

Can't get the ID from a navbar list href

this is my first question, so hopefully I won't screw it.
This is .net framework 3.5
The MasterMenu.ascx has a navbar list and each item redirects to a specific url. And each item from the list has an ID.
What I'm (unsuccessfully) trying to do is, given the URL, get the ID of the item who send it there.
I.E. (MasterMenu.ascx):
<div id="navbar" class="collapse navbar-collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown" id="DropDownPF” runat="server" visible="false"><a id="A2" role="button" data-toggle="dropdown">PF<span class="caret"></span></a>
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
<li visible="false" id="DropDepositSSN" runat="server">Deposit </li>
<li visible="false" id="DropPFSSN" runat="server">Check</li>
<li visible="false" id="DropInterfaceSSN" runat="server">Interface</li>
</ul>
</li>
When I get the current path, lets say
~/Check.aspx
I want a method that returns the id of the item:
DropPFSSN
Thanks in advance!

Customize HTML output of DataList control of ASP.NET

How can I generate output of DataList control in the following format?
<ul id="container">
<li data-genre="cricket"> Cricket Sport </li>
<li data-genre="boxing"> Boxing Sport </li>
<li data-genre="Swimming"> Swimming Sport </li>
<li data-genre="Kite"> Kite Sport </li>
</ul>
Why I need to generates like this because of I need to apply following JQuery plugin
https://luis-almeida.github.io/filtrify/music.html
Following is DataList code. I am biding this List object on server side
<asp:DataList ID="dlSports" runat="server" RepeatColumns="6" CellSpacing="5" RepeatLayout="Table" >
<ItemTemplate>
<image> Image will display here</image>
<span><%# Eval("SportName") %></span>
</ItemTemplate>
</asp:DataList>
I am using DataList because I need to display data in tabular form like showed in https://luis-almeida.github.io/filtrify/music.html.
------- EDITED -----------
HTML output like this.
<table id="MainContent_dlSports" cellspacing="5" class="text-center" style="height:100%;width:100%;">
<tr>
<td>
<li>
<image> ....</image>
<span>Cricket Sport</span>
</li>
</td>
<td>
<li>
<image> ....</image>
<span>Boxing Sport</span>
</li>
</td>
<td>
<li>
<image> ....</image>
<span>Swimming Sport</span>
</li>
</td>
</tr>
.......
.......
.......
</table>

transfer value from master page to another master page

i want to know if it is possible to transfer a value from a master page to anotehr master page? i want to transfer my "Name" value to the next masterpage. images shown below
the name "Jedi Ablaza" will be transffered into the next master page
and my code for my first master page
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a runat="server" href="~/" style="color: white">Home</a></li>
<li id="forHR" runat="server" class="dropdown">
<a id="hr" class="dropdown-toggle" runat="server" data-toggle="dropdown" href="#" style="color: white">HR</a>
<ul class="dropdown-menu">
<li>Core Values</li>
<li>Rater & Employee Relation</li>
</ul>
</li>
<li>
<a id="toMosef" runat="server" href="MOSEF/WebForm1.aspx" style="color: white">MOSEF</a>
</li>
to the highlighted portion of the new masterpage.
how can I do that? thanks!
Use Sessions.
Assign to the session:
Session["username"] = txtusername.text;
retrieve from the session:
string username = Session["username"].toString();

Showing Data in a specific format inside asp repeater

I am using a repeater control which have my data retrieved from database. I need to show them in the following format in the HTML.
<ul>
<li>
<div>content 1</div>
<div>content 2</div>
<div>content 3</div>
<div>content 4</div>
</li>
<li>
<div>content 5</div>
<div>content 6</div>
<div>content 7</div>
<div>content 8</div>
</li>
</ul>
I need to put a li tag for each 4 items that are bound from the repeater.
if any of you guys know how to achieve this, please let me know. Thanks.
Try Below Code- Data-Binding Expressions - Eval()
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<div><%# Eval("content1") %></div> // content1 is DB Column Name
<div><%# Eval("content2") %></div> // content2 is DB Column Name
<div><%# Eval("content3") %></div> // as so on for all content... till 8
<div><%# Eval("content4") %></div>
</li>
<li>
<div><%# Eval("content5") %></div>
<div><%# Eval("content6") %></div>
<div><%# Eval("content7") %></div>
<div><%# Eval("content8") %></div>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>

Creating Bootstrap-Datepicker with multiple asp:Repeater TextBoxes

I am creating form using an asp:Repeater, each object of the repeater has one textbox that will need it's own unique bootstrap-datepicker linked to it. (the datepicker is a javascript addon to twitter-bootstrap 2.3.2 found here: http://www.eyecon.ro/bootstrap-datepicker -- Wanted to add that the link is safe, but there is no real need to view the page in regards to the question)
My problem is that I am not able to use the asp.net clientid to correctly target the text boxes.
aspx code:
<asp:Repeater ID="repList" runat="server">
<HeaderTemplate>
<ul class="gridul">
<li class="gridli userrole"><span class="short liheader">Jenz ID</span></li>
<li class="gridli"><span class="long liheader">Name</span></li>
<li class="gridli"><span class="short liheader">S/S/F</span></li>
<li class="gridli"><span class="short liheader">Date</span></li>
<li class="gridli"><span class="long liheader">Payment Type</span></li>
<li class="gridli"><span class="mid liheader">Sent to B.O.</span></li>
</ul>
</HeaderTemplate>
<ItemTemplate>
<ul class="gridul">
<li class="gridli userrole"><span class="short"><%# Eval("jenzabar_id") %></span></li>
<li class="gridli"><span class="long"><%# Eval("first_name") %>&nbsp<%# Eval("last_name") %></span></li>
<li class="gridli"><span class="short"><%# Eval("student_staff_faculty") %></span></li>
<li class="gridli"><span class="short"><%# Eval("reservation_date") %></span></li>
<li class="gridli"><span class="long"><asp:TextBox ID="PayType" runat="server" Text='<%# Eval("payment_type") %>' /></span></li>
<li class="gridli"><span class="mid"><asp:TextBox ID="SentBo" runat="server" Text='<%# Eval("sent_to_bo") %>' /></span></li>
</ul>
<asp:HiddenField ID="hidJenz" runat="server" Value='<%# Eval("jenzabar_id") %>' />
<asp:HiddenField ID="hidPayType" runat="server" Value='<%# Eval("payment_type") %>' />
<asp:HiddenField ID="hidSentBo" runat="server" Value='<%# Eval("sent_to_bo") %>' />
</ItemTemplate>
</asp:Repeater>
The textbox being targeted is:
<asp:TextBox ID="SentBo" runat="server" Text='<%# Eval("sent_to_bo") %>' />
In my scripts.js I can target an individual textbox by viewing the aspx source and copying in the generated id such as "ctl00_MainContent_repList_ctl01_SentBo" but I cannot figure out how to use <%# SentBo.ClientID %> with the repeater. It just doesn't work.
Example:
$(function () {
$('ctl00_MainContent_repList_ctl01_SentBo').datepicker();
})
is successful
$(function () {
$('<%#= SentBo.ClientID %>').datepicker();
})
is not
Did more digging. Found the answer, finally.
Replace:
$('ctl00_MainContent_repList_ctl01_SentBo').datepicker();
with:
$(this).find("input[type=text][id*=SentBo]").datepicker();

Categories

Resources