I'm displaying summary and details customer info in each repeater row - inside the repeater .
The summary stuff is it's own div: (id="divHistory_Summary). The details stuff in it's own div: (id="divHistory_details" )
The details div is hidden by default with inline style: display: none;
<asp:Repeater ID="RepeaterCustHistory" runat="server">
<ItemTemplate>
<div id="divHistory_Summary" class="cust_summary" style="width: 100%; cursor: pointer" >
<div id="divTicketNumber" style="display: inline; float: left;">
<u><strong>Ticket ID:</strong> <asp:Label ID="lblCustHelpDeskTicketId" runat="server" Text='<%# Eval("HelpDesk_id") %>' /></u>
</div>
<div id="divProblem" style="display: inline; float: left; padding-left: 10px;">
<strong>Problem:</strong> <asp:Label ID="lblProblem" runat="server" Text='<%# Eval("HelpDesk_problem") %>' />
</div>
<div id="divStatus" style="display: inline; float: left; padding-left: 10px;">
<strong>Status:</strong> <asp:Label ID="Label1" runat="server" Text='<%# Eval("HelpDesk_name") %>' />
</div>
</div>
<div id="divHistory_details" class="cust_details" style=" width: 100%; float: left; display: none; ">
<strong>Solution:</strong> <asp:Label ID="lblSolution" runat="server" Text='<%#Eval("HelpDesk_solution") %>' ></asp:Label>
</div>
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
At the bottom of my aspx page I have my jquery:
<script src='<%= ResolveUrl("~/Scripts/jquery-1.4.1.js") %>' type="text/javascript" ></script>
<script type="text/javascript">
$(document).ready(function () {
$(".cust_details").hide();
$(".cust_summary").click(function () {
$(this).next(".cust_details").slideToggle(100);
});
});
</script>
I don't have the jquery.js file in the head of my app, so I hope it's ok to call the script right here. This app has many nested master pages, and didn't know which one to put the call to jquery file.
The page loads, repeater populates, the details stuff is hidden. When clicking the summary div, nothing happens - the details stuff won't show.
Does anyone have any ideas on how to get this show/hide div to work like this? THank You!
I'm using VS2010, Framework 2.0, C#
Try this:
$(this).nextAll('div[class="cust_details"]').eq(0).slideToggle(100);
I have ran a quick test and it seems to be working.
Try this:
<script type="text/javascript">
$(document).ready(function () {
$(".cust_details").hide();
$(".cust_summary").click(function () {
$(this).nextAll('div[class="cust_details"]').eq(0).slideToggle(100);
});
});
</script>
Related
We have the follow repeater construct on our home page:
<asp:Repeater runat="server" ID="repShortcuts" OnItemDataBound="repShortcuts_ItemDataBound">
<ItemTemplate>
<asp:LinkButton runat="server" ID="lnkShortcut" PostBackUrl='<%# Eval("LinkWithTab") %>' Text="" ViewStateMode="Enabled" Style="text-decoration: none;">
<div style="margin-left: 2px; margin-right: 2px; height: 90px; display: inline-block; white-space: normal; text-align: center; vertical-align: top;">
<asp:Image
runat="server"
ID="imgShortcut"
ImageUrl='<%# String.Format("./Icons/{0}{1}",Session["DetailsBoxTextColour"].ToString().ToLower() == "black" ? "d" : "", Eval("ParentIcon")) %>'
CssClass="MenuImage"
Style="margin-bottom: 0px;"
/>
<asp:Label
runat="server"
ID="lblShortcut"
Text='<%# Eval("DisplayName") %>'
CssClass="MenuText"
Style="font-size: small; overflow: hidden; width: 110px; white-space: pre-line; text-wrap: normal; display: inline-block;"
></asp:Label>
</div>
</asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblEmptyData" runat="server" CssClass="DetailsBoxSettingLabel MarginTop5" Text="You currently have no shortcuts." Visible="false" />
</FooterTemplate>
</asp:Repeater>
When viewing the page (GET):
On server A (live) the inner controls are rendered as expected (this is an image and some text). Also works on all our dev machines.
On server B (uat) and some user machines which have the application installed, the inner controls are removed and we are just left with the anchor tag for the linkbutton.
This seems to be related to Microsoft Connect issue 718810 which is nowhere to be found now. Completely lost as to what's going on here. Same code, same server setup essentially.
I have the following code in ASP.NET.
The problem is that this HyperLink(hpRecord) works for all surface of "posts_listDiv" other than the two images which are not clickable in IE 9.
I tested that code and works fine in all browsers other than Internet Explorer.
<asp:Repeater ID="RepeaterCategories" runat="server">
<ItemTemplate>
<asp:HyperLink ID="hpRecord" runat="server" NavigateUrl='link'>
<div id="posts_listDiv" class="posts_listDiv">
<div id="pict1Div" class="pict1Div">
<asp:Image ID="picture" runat="server" Width="100px" Height="80px" ImageUrl='link'/>
</div>
<div id="pict2Div" class="pict2Div">
<asp:Image ID="pict2" runat="server" Width="100px" Height="80px" ImageUrl='link'/>
</div>
<div id="detailsDiv" class="detailsDiv">
<%--text--%>
<%# Eval("...")%>
<br />
<%--by user--%>
<i style="color:blue"><%# Eval("FirstName") %> </i>
</div>
</div>
</asp:HyperLink>
</ItemTemplate>
</asp:Repeater>
and this is CSS for "posts_listDiv":
.posts_listDiv
{
background-color:red;
margin-left:5px;
float:left;
width:232px;
height:171px;
word-wrap: break-word;
font-size:14px;
margin-left:8px;
margin-top:10px;
}
Add a style to "posts_listDiv" parent div.
.parent {
display: block;
}
I'm trying to learn CSS3 and get away from using table tags. Working with Visual studio 2010, .net 4.0 and vb.nt in an asp.net project. I have a listview that i'm trying to get the rows to alternate color. What i have works but only partially. What is rendered to screen is several rows that have wrapping text. The shading is only effecting a small line across the screen.. it does not cover the entire row. Here is the code:
div.row
{
clear: both;
padding-top: 5px;
}
div.row:nth-child(1n+3)
{
background-color: #C0C0C0;
}
div.row span.label
{
float: left; /*width: 100px;*/
text-align: right;
padding-right: 5px;
font-weight: bold;
}
div.row span.cell
{
float: left; /*width: 335px;*/
text-align: left;
}
Here is the markup:
<ItemTemplate>
<div class="row" >
<span class="cell" style="width: 200px;">
<asp:HyperLink ID="lblCalendarDataID" runat="server" NavigateUrl='<%# "CalendarAddEdit.aspx?ID=" & databinder.eval(container.dataitem,"CalendarDataID")%>'
Text='<%# databinder.eval(container.dataitem,"Title")%>' />
</span>
<span class="cell" style="width: 150px;">
<asp:Label ID="lblStartDate1" runat="server" Text='<%# databinder.eval(container.dataitem,"StartDate1","{0:d}")%>' />
-
<asp:Label ID="lblEndDate1" runat="server" Text='<%# databinder.eval(container.dataitem,"EndDate1","{0:d}")%>' />
</span>
<span class="cell" style="width: 150px;">
<asp:Label ID="lblStartTime1" runat="server" Text='<%# databinder.eval(container.dataitem,"StartTime1", "{0:t}")%>' />
-
<asp:Label ID="lblEndTime1" runat="server" Text='<%# databinder.eval(container.dataitem,"EndTime1", "{0:t}")%>' />
</span>
<span class="cell" style="width: 350px;">
<asp:Label ID="lblDescription" runat="server" Text='<%# databinder.eval(container.dataitem,"Description")%>' />
</span>
<span class="cell" style="width: 50px;">
<asp:HyperLink ID="hlDeleteID" runat="server" NavigateUrl='<%# "CalendarDelete.aspx?ID=" & databinder.eval(container.dataitem,"CalendarDataID")%>'
Text="Delete" />
</span>
</div>
</ItemTemplate>
anyone know what i'm doing wrong. I tried to use the alternatingItemTemplate but could not get it to shade. In that senerio.. i did a
<div class="row" style="background-color: #C0C0C0;">
any help would be great.
To have your background shading do what you want, try modifying this style:
div.row:nth-child(1n+3)
{
background-color: #C0C0C0;
}
to be this:
div.row:nth-child(1n+3) span
{
background-color: #C0C0C0;
}
to actually apply the background color to the spans that contain the content.
I have a dropdownlist (asp.net) and when user change the selection from the dropdownlist it display respected div.
i need help in aligning the controls. and want to look like this:
DropdownListControl -- > selected_div -- > button
below is my soucr code....
<div style="width: 880px; padding-top: 2px; border-bottom: none;
height: 28px;">
<asp:Label ID="lblFilterResultsBy" runat="server" Text="Filter Results by:"></asp:Label>
<asp:DropDownList ID="ddlFilter" runat="server" Width="221px">
<asp:ListItem Text="Select..." Value=""></asp:ListItem>
<asp:ListItem Text="Date" Value="DATE"></asp:ListItem>
<asp:ListItem Text="Subject" Value="SUBJECT"></asp:ListItem>
<asp:ListItem Text="Status" Value="STATUS"></asp:ListItem>
</asp:DropDownList>
<div id="divDateRangeSearch">
<div style="float: left">
<asp:Label ID="lblDateRange" runat="server" Text="Date Range"></asp:Label>
<br />
<uc1:DatePicker ID="FromDate" runat="server" />
<uc1:DatePicker ID="ToDate" runat="server" />
</div>
</div>
<div id="divSearchSubject" >
<div style="float: left">
<asp:Label ID="lblSubject" runat="server" Text="Subject"></asp:Label><br />
<asp:TextBox ID="txtSubject" runat="server" Width="225px"></asp:TextBox>
</div>
</div>
<div id="divStatusSearch">
<div style="float: left">
<asp:Label ID="lblStatus" runat="server" Text="Status" ></asp:Label>
<br />
<asp:DropDownList ID="ddStatus" runat="server" Width="152px" >
</asp:DropDownList>
</div>
</div>
</div>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
UPDATE:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<style type="text/css">
#main {
width: 800px;
}
#select {
float: left;
width: 250px;
border: 1px solid blue ;
}
#holder {
position: relative;
width: 300px;
float: left;
margin-left: 20px;
border: 1px solid red ;
}
#div_date, #div_subject, #div_status {
position: absolute;
top: 0;
left: 0;
}
#button {
float: left;
margin-left:20px
}
</style>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript">
$(document).ready(function () {
$('#filterResultsBy').change(function () {
var sel = $(this).val();
$('#div_date').hide();
$('#div_subject').hide();
$('#div_status').hide();
if (sel === 'Date') {
$('#div_date').show();
}
else if (sel == 'Subject') {
$('#div_subject').show();
}
else if (sel == 'Status') {
$('#div_status').show();
}
});
});
</script>
<div id="main">
<div id="select">
Filter Results by:
<select id="filterResultsBy">
<option value="">Select...</option>
<option value="Date">Date</option>
<option value="Subject">Subject</option>
<option value="Status">Status</option>
</select>
</div>
<div id="holder">
<div id="div_date" style="width: 250px; display: none;" >
Date Range:
<asp:textbox width="50px" id="startdate" runat="server" /> - to - <asp:textbox width="50px" id="enddate" runat="server" />
</div>
<div id="div_subject" style="display: none;" >
Subject:
<asp:TextBox ID="txtSubject" runat="server" Width="225px" ></asp:TextBox>
</div>
<div id="div_status" style="display: none;" >
Status:
<asp:DropDownList ID="ddlStatus" runat="server" Width="152px">
</asp:DropDownList>
</div>
</div>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
</div>
</form>
</body>
</html>
Sure, not a problem. You can clean up your markup a bit on the div's that appear by removing the nested <div style="float: left">. The CSS would be as follows:
select {
float: left;
}
#divDateRangeSearch, #divSearchSubject, #divStatusSearch, #btnSearch {
float: left;
margin-left: 20px; /* put some space between the elements */
}
The above assumes that you're creating and destroying the respected <div>'s as you hide and show them. If you need them to all exist in the source and you'll show and hide them, you'll need something like the following:
#divHolder {
position: relative;
float: left;
width: 200px; /* adjust as needed */
}
#divDateRangeSearch, #divSearchSubject, #divStatusSearch {
position: absolute;
top: 0;
left: 0;
}
And the HTML:
<div id="divHolder">
<!-- Markup for the 3 divs would go in here -->
</div>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
Try the following. You'll have to add your other two divs back in, and I'm assuming you toggle their visibility based on selection.
<div style="width: 880px; padding-top: 2px; border-bottom: none;
height: 28px;">
<div style="float:left">
<asp:Label ID="lblFilterResultsBy" runat="server" Text="Filter Results by:"></asp:Label>
<asp:DropDownList ID="ddlFilter" runat="server" Width="221px">
<asp:ListItem Text="Select..." Value=""></asp:ListItem>
<asp:ListItem Text="Date" Value="DATE"></asp:ListItem>
<asp:ListItem Text="Subject" Value="SUBJECT"></asp:ListItem>
<asp:ListItem Text="Status" Value="STATUS"></asp:ListItem>
</asp:DropDownList>
</div>
<div id="divStatusSearch">
<div style="float: left">
<asp:Label ID="lblStatus" runat="server" Text="Status" ></asp:Label>
<asp:DropDownList ID="ddStatus" runat="server" Width="152px" >
</asp:DropDownList>
</div>
</div>
<div style="float:left">
<asp:Button ID="btnSearch" Text="Search" runat="server" />
</div>
I have an application developed in asp.net which set innerhtml of div. I am creating an html string to show googlemap. It works fine. But when I put my div inside update panel. it doesnt show googlemap in div. Here is my aspx file code:
</td>
</tr>
<tr>
<td colspan="4">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<div id="map_canvas" runat="server" style="width: 100%; height: 1500px; margin-bottom: 2px;
text-align: center;">
<asp:Panel ID="Panel1" runat="server">
<%--Place holder to fill with javascript by server side code--%>
<asp:Literal ID="js" runat="server"></asp:Literal>
<%--Place for google to show your MAP--%>
<div id="Div1" style="width: 100%; height: 728px; margin-bottom: 2px;">
</div>
<br />
</asp:Panel>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnShow" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
here is my button click event.
protected void btnShow_Click(object sender, EventArgs e)
{
// works fine without update panel.
map_canvas.InnerHtml = showMapWithPoints();
}
Hai Asif,
May be you should take a look at this.....
http://www.reimers.dk/blogs/jacob_reimers_weblog/archive/2008/11/23/an-example-using-updatepanels-and-google-maps.aspx
When you do:
map_canvas.InnerHtml = showMapWithPoints();
You are overwriting everything, including all your server side controls, within that div.
Are you doing anything that requires those controls to be available such as you 'js' and 'div1' controls?