I am trying to use collection firs item property in another each but it does not work,it does not give any error but also it does not work
Bagaj not work but
Bagaj1 work,altough it is same code,what is problem with this ?
{{#each Flights}}
<tr>
<td>
<div class="col-md-10">
<strong><span data-i18n="app.booking.flight-number"></span></strong>{{FlightNumber}}
<strong>Bagaj:</strong>{{PassengerPricing.0.BaggageDescription}}
</div>
</td>
</tr>
{{/each}}
<strong>Bagaj1:</strong>{{PassengerPricing.0.BaggageDescription}}
My purpose is to display a table with the leftmost column containing course title at a college, and the rest of the row information regarding textbooks to that course.
This is what it looks like now:
current table
Here is an image of what I would like to happen:
Textbook information
Here is my code for what I have now.
{{#each getCourses}}
<tr>
<td>{{this}}</td>
{{#each getTextbooks this}}
<td>
{{title}}
<br>
</td>
<td>Editor</td>
<td><span class="label label-success">Active</span>
</td>
<td> <button type="button" class="btn btn-primary btn-sm">I have it</button> </td>
<td> <button type="button" class="btn btn-primary btn-sm">I want it</button> </td>
{{/each}}
</tr>
{{/each}}
Before this table, a user is able to select several courses from a dropdown, and then I store the courses in a session and get them and iterate. Each course has textbooks, so I iterate over the list of textbooks. However the problem I face is that I'm not sure how to incorporate rowspan or something like that to allow multiple rows of textbook information for each class.
I am using Symfony2 and TWIG. With "path" I will open a second page and set some parameters.
{% set place = "The City" %}
<tr>
<td class="tdstellenangebot_zelle">
<a href="#" onclick="anzeige_job('{{ path("_anzeige_job",{kznr:102,ort:"unseren Standort in " {{ place }} ,filiale:1} ) }}')">
The jobdescription
</a>
</td>
<td class="tdstellenangebot_zelle textBold">{{ place }} </td>
</tr>
But the script dont work.
How can I set the place in the path with the variable ?
Thanks alot for your help.
You need simple concatenation:
{% set place = "The City" %}
<tr>
<td class="tdstellenangebot_zelle">
<a href="#" onclick="anzeige_job('{{ path("_anzeige_job", { kznr: 102, ort:"unseren Standort in " ~ place, filiale: 1 }) }}')">
The jobdescription
</a>
</td>
<td class="tdstellenangebot_zelle textBold">{{ place }} </td>
</tr>
Take a look at tilde sign ~. It is like + in JavaScript and . in PHP and is used to concatenate strings.
I have created web user control for calendar. I.e it has a textbox and a calendar image. By clicking on calendar popup the calendar opens. Then by selecting any date it stores the year of that date. I use this code:
<script language="javaScript" type="text/javascript" src="Scripts/Calendar.js"> </script>
<link href="Styles/Calendar.css" rel="stylesheet" type="text/css" />
<table>
<tr>
<td>
<input type="text" name="datum1"/>
</td>
<td>
<img id="Img1" src="images/calFinal.jpg" alt="" runat="server" onclick="setYears(1947, 2040);
showCalender(this, 'datum1');" />
</td>
</tr>
</table>
<div>
<!-- Calender Script -->
<table id="calenderTable">
<tbody id="calenderTableHead">
<tr>
<td colspan="4" align="center">
<select onchange="showCalenderBody(createCalender(document.getElementById('selectYear').value,
this.selectedIndex, false));" id="selectMonth">
<option value="0">Jan</option>
<option value="1">Feb</option>
<option value="2">Mar</option>
<option value="3">Apr</option>
<option value="4">May</option>
<option value="5">Jun</option>
<option value="6">Jul</option>
<option value="7">Aug</option>
<option value="8">Sep</option>
<option value="9">Oct</option>
<option value="10">Nov</option>
<option value="11">Dec</option>
</select>
</td>
<td colspan="2" align="center">
<select onchange="showCalenderBody(createCalender(this.value,
document.getElementById('selectMonth').selectedIndex, false));" id="selectYear">
</select>
</td>
<td align="center">
<font color="#003333" size="+1">X</font>
</td>
</tr>
</tbody>
<tbody id="calenderTableDays">
<tr style="">
<td>Sun</td>
<td>Mon</td>
<td>Tue</td>
<td>Wed</td>
<td>Thu</td>
<td>Fri</td>
<td>Sat</td>
</tr>
</tbody>
<tbody id="calender">
</tbody>
</table>
<!-- End Calender Script -->
</div>
The problem occurs when I use the user control twice on the same web form. I have registered the control. When I use it once, it works proper. But I want it at two places. So, please give some solution on how to use the user control more than one time on the same web form. I have given different IDs for the user control, but it still does not work.
Code for user control:
<tr>
<td class="directorytdWidth directorylabel">
School Name:
</td>
<td class="directoryTdPadding">
<asp:TextBox ID="txtSchoolName" runat="server" Width="120px" ForeColor="#FF9F00"></asp:TextBox>
</td>
</tr>
<tr>
<td class="directorytdWidth directorylabel">
School Passout Year:
</td>
<td class="directoryTdPadding">
<uc1:calendar ID="schoolPassout" runat="server" />
</td>
</tr>
<tr>
<td class="directorytdWidth directorylabel">
College Name:
</td>
<td class="directoryTdPadding">
<asp:TextBox ID="txtCollegeName" runat="server" Width="120px" ForeColor="#FF9F00"></asp:TextBox>
</td>
</tr>
<tr>
<td class="directorytdWidth directorylabel">
College Passout Year:
</td>
<td class="directoryTdPadding">
<uc1:calendar ID="collegePassout" runat="server" />
</td>
</tr>
Use the Same User control but With diferent ID. For example (See code below)
Reg Your User control in you Web page
<%# Register Src="~/Controls/SearchAffiliated.ascx" TagPrefix="uc" TagName="SearchAffiliated" %>
First User Control call
<uc:SearchAffiliated runat="server" ID="ucSearchAffiliated" />
Second User Control Call
<uc:SearchAffiliated runat="server" ID="SearchAffiliated1" />
See The Users Controls have diferents IDs, That Works For call The same UC in one web form.
Cheers.
Use the loop of how many times that u want the usercontrol to display:
for(int i=0;i < n; i++) //Define the number of time that u want to display
{
usercontrolname.id="UC"+i;//Assign the id for that usercontrol
//add line of code,that controls in placeholder or panel
}
You can use same user control in same page in N number of times. either it dynamically or statically. Only the thing is we need to give the different ID for the usercontrol
This need to add in your Reg
<%# Register Src="~/UserControls/Hello.ascx" TagPrefix="uc" TagName="Hello" %>
calling the user control 1
<uc:Hello runat="server" ID="ucHello1" />
calling the user control 2
<uc:Hello runat="server" ID="ucHello2" />
I faced same problem but the problem was not related with the ID you prefer to use inside the asp.net page. Because I guess asp.net automatically generates ID for each element in page if it doesn't have one.
The problem was I copied ascx files and forget to change their class names. Make sure you use different class names for each user control.
<%# Control Language="C#" ClassName="ucSchema2" %>
I know this i late to the game but maybe someone can use this answer anyway.
Using a static clientside id for a html element in a user control and then using that user control multiple times will results in invalid html.
You are only allowed to use an id once on a html page otherwise getElementById (which returns a single element) will not know which element to get and then you will probably not get any element whatsoever.
You need to make those clientside ids inside the user control truely unique, i.e. selectMonth, selectYear.
This might be done by appending the ClientID of the user control to the element id. Something like this (not sure if this approach really works but you get the idea):
<select onchange="showCalenderBody(createCalender(document.getElementById('selectYear_<%=this.ClientID%>').value,
this.selectedIndex, false));" id="selectMonth_<%=this.ClientID%>">
This way the clientside id should be a combination of locally unique ids and the page unique control ids.
My HTML looks something like this:
<table class="disabled">
<tr>
<td>
<input blah blah>
</td>
<td>
<img id="reallyLongASP.NetID" etcetc/>
</td>
</tr>
</table>
In all with a class indicated as "disabled", I want to set visibility: hidden on the <img>. I can disable using the crazy id ASP.Net gives, but would like to do a general statement that affects every control in the <table>
Thanks for the help in advance,
If I understand you correctly, you'll just want to select all images within tables having the class specified:
table.disabled img { visibility:hidden }