Updatepanel and fancybox not working unless fancybox is opened twice - updatepanel

Ok I have a page being pulled through onto the fancybox popup,
(note: the paging works 100% on the page itself),
but when on the fancybox I attempt to page through the repeater and nothing happens.
I then close the popup and reopen it without refreshing the page, and paging now works?
I refresh the page then have to go through the process of opening the popup then trying to page through the repeater then close the popup then reopen it and the paging works again.
Can anyone point me in the right direction as to what maybe causing this? I've already attempted Change the 'body' to 'form' method's.
EDIT: It does manage 1 postback, then it freezes and if reopened works for more then 1 postback.
EDIT: I have found that when the update panel send the request and comes back it creates a secondary __VIEWSTATE object in the updatepanel.
Code for the page being called:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Search.aspx.cs"Inherits="AfricaCentre.Search" EnableEventValidation="false" EnableViewState="false" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<%--<script type="text/javascript" src="<%= ResolveUrl("~/scripts/Scripts.js") %>"></script>--%>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<!-- SEARCH -->
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
Hello
<asp:Button Text="Test" runat="server" />
</ContentTemplate>
</asp:UpdatePanel> </form>
</body>
</html>
Code Link button calling the fancybox with script:
<a id="search" href="/Search" class="fancybox.ajax">SEARCH</a>
$("#search").fancybox(
{
type: 'ajax',
autoSize: false,
padding: 0,
width: 800,
height: 567,
scrolling: 'no',
openEffect: 'fade',
openSpeed: 'slow',
transitionIn: "elastic",
transitionOut: "elastic",
autoScale: false,
hideOnContentClick: false,
afterLoad: function () {
}
}
);

I have just used an iframe to resolve my problem.

Related

How to link css file in vb asp.net project

How to link css file in vb asp.net project
Right now my css file is not beeing run from Home.aspx files. What is my All_Body.css file path that I should type in Home.aspx file.
I need to put this code on server so I can not use full path with my computer username
project Files:
>MyWebsite
>Styles
>All_Body.css
>UI
>Home.aspx
>Master.master
All_Body.css full path
C:\Users\Dave\source\WebSites\MyWebsite\Styles\All_Body.css
Home.aspx
<asp:Content id="Home_Content1" ContentPlaceHolderID="head" runat="server">
<link rel="stylesheet" type="text/css" href="~\Styles\All_Body.css" />
...
</asp:Content>
Master.master
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
...
</body>
</html>
I cleared my browser cache and it worked.
The browser doesn't reload the css or js files, so as a developer you have to do hard refresh /reload every time you update the css or js files and you must add query string like ?v=0.01 after the href or src when you publish the website to the server and change the number every time.
ex:
href="styles.css?v=0.01"
src="main.js?v=0.01"
Now the browser will think this is a new file and will reload it in the client browsers.
Home.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
....
</asp:Content>
Master.master
The link to your CSS file should be in the <head> element of the master page:
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<link rel="stylesheet" type="text/css" href="Styles/All_Body.css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</form>
</body>
</html>
Note that I updated the path to your CSS file which was incorrect; this link is relative to the root. Also, the "~/" only works when you include runat="server" - either way it is not needed when using a relative link for CSS. You also had a malformed head content placeholder. The content placeholder for the main content was missing from your master page. There was no form tag so nothing could work. In fact the code you presented would not even compile. If you simply used the standard Web Forms template out of the box with the master page option, it would have worked.
Tip: The easiest way to get the CSS link correct in a master page is to drag the CSS file from Solution Explorer into the <head> section of the master page in Visual Studio.

v14.0 Web Report Viewer Control not displaying body of report

I am hoping someone has an idea about what I am experiencing.
I've worked with various versions of the Report Viewer control (both WinForms and Web) over the years and have just started trying to use the latest HTML5 based version in an ASP .NET Wed Forms project.
My environment is as follows:
Dev laptop with Windows 7 and SQL Server 2014 Including SSRS.
Various remote servers with 2008R2, 2014 and 2016 Reporting Services on them.
I've followed this tutorial page from the Microsoft Docs:
https://learn.microsoft.com/en-us/sql/reporting-services/application-integration/using-the-webforms-reportviewer-control, and have set up a page that points at remote server reports.
Code Behind:
protected void Page_Init(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
rv14.ProcessingMode = ProcessingMode.Remote;
ServerReport serverReport = rv14.ServerReport;
// A 2016 Report
serverReport.ReportServerUrl = new Uri("http://2016server/reportserver");
serverReport.ReportPath = "/Sports";
// A 2014 Report
// serverReport.ReportServerUrl = new Uri("http://2014server/reportserver");
// serverReport.ReportPath = "/SQL2014DemoReports/VertBar";
// A 2008R2 Report
// serverReport.ReportServerUrl = new Uri("http://2008R2server/Reportserver");
// serverReport.ReportPath = "/DemoReports/VertBar";
}
}
ASPX
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Reports.aspx.cs" Inherits="WebNew.Reports" %>
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Reports</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="rv14" runat="server" Width="100%" Height="100%"></rsweb:ReportViewer>
</form>
</body>
</html>
When I run the page, the new HTML based toolbar renders and I get and I get the "loading" mini dialog showing, but then nothing. No report body rendered. The report currently uncommented in the code is a simple list of sports a couple of pages long, nothing complex.
I can tell that the server was contacted and replied as I am seeing the pagination control indicating that there is more than one page, and if I then use any of the export controls, such as PDF, the PDF DOES have the correct rendered output in it.
It is simply not showing in my web page.
I've tried IE (11), Chrome (58) and Firefox (49) and all display the same behaviour. It does not matter which of the servers I target or if I connect to my local instance.
Has anyone seen this behaviour, have any pointers to what might be happening, or a good way of trying to debug?
Many thanks
OK, so I stumbled across a solution to what I was seeing. It would seem that the problem is to do with what the viewer is contained within.
If I wrap the viewer in a DIV and set it's height to 100 vertical height then the viewer does correctly show its content. Previously it must have effectively been in a container of height zero.
Working ASPX code looks like this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>2016 Report Viewer Test</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="height:100vh">
<rsweb:ReportViewer
ID="rv14"
runat="server"
Width="100%"
Height="100%">
</rsweb:ReportViewer>
</div>
</form>
</body>
</html>
Hope this helps someone one day. :-)
Add this, worked for me.
rv14.SizeToReportContent = true;

HTML / ASPX pages not validating and not rendering or validating

As a disclaimer, I have read all of the posts regarding this topic and have tried all of the suggestions and still don't seem to be able to get this to work. So, for purposes of this question, I have created a very simple Master page file and an index file. The code for the master page is:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="master.master.cs" Inherits="EckankarInOklahoma.master" %>
<!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>ECKANKAR in Oklahoma</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
The index page's code is as follows:
<%# Page Title="" Language="C#" MasterPageFile="~/master.Master" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="EckankarInOklahoma.index" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
I DON'T GET THIS AT ALL :)
</asp:Content>
When I debug through Visual Studio, I get the expected white screen that just says:
I DON'T GET THIS AT ALL :)
But after publishing, uploading to the website via ftp and going to the website, I get nothing but my code. I have saved the files with encoding but without BOM. I used Sublime Text editor to ensure I was saving without BOM. I have published and then uploaded, and I have uploaded without publishing. All to no avail. I still get unrendered code.
Additionally, I have tried to validate through W3C Schools and the code will not validate. I have 3 errors and 3 warnings.
Can someone please advise what I might be doing wrong? Thanks in advance. Have a great weekend!
***update 1 = I tried what MarcusVinicius suggested and that did get me closer, but now instead of giving me my code as text, it says :
This is a marker file generated by the precompilation tool, and should not be deleted!
I am unsure of where to go from here. I published the website as not updatable and the config files are in the root directory. Any more ideas for me to try? Again, I appreciate all of the help and suggestions. :)

'TextBox' must be placed inside a form tag with runat=server"

hey guys i'm building a website for a school assignment and i want to create a multi line text box but when i do i get the error "'TextBox' must be placed inside a form tag with runat=server" I've looked it over and it wouldn't go away by inserting a form tag with runat server before the text box code. how can i fix this? here's the code:
<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">
<form id="Form1" runat="server">
<div id="body">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</asp:Content>
Just remove the form tag from your content page - the form tag on the master page will be sufficient. You will need the ContentPlaceHolder tags on the master page to be within the form for this to work.
like
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="bodycontent" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>

Stop page refresh on Image Button Click

This is the code what i tried:
<asp:ImageButton ID="imgDropArrow" class="cssDropArrow" ImageUrl="~/Styles/Down.gif" OnClick="ImageDropArrow_Click" runat="server"/>
Everytime I click on this imagebutton, page refreshes.
What I want on click is to run the serverside("ImageDropArrow_Click") function and no page refresh.
Any help will be highly appreciated.
I suggest to use UpdatePanel in Your Code
for example
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<!--Content Here-->
<asp:ImageButton ID="imgDropArrow" class="cssDropArrow" ImageUrl="~/Styles/Down.gif" OnClick="ImageDropArrow_Click" runat="server"/>
</ContentTemplate>
</asp:UpdatePanel>
</form>
Look at the following link. It might be helpful for you.
http://www.codeproject.com/Articles/401903/AJAX-for-Beginners-Part-Understanding-ASP-NET-AJ
At first use runat="Server" and you can use updatepanle with imagebutton