I used this example from here
http://www.asp.net/ajaxlibrary/jqueryui_progressbar.ashx
Every thing works fine except the progress
This is my design
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default15.aspx.cs" Inherits="Default15" %>
<!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></title>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css"
rel="Stylesheet" />
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/jquery-ui.min.js"></script>
<script type="text/javascript">
$("#progress").progressbar({
value: document.getElementById('<%=litprogress.ClientID%>').value
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>
Wizard progress</h1>
<div id="progress">
<asp:Literal ID="litprogress" runat="server"></asp:Literal>
</div>
<asp:Panel ID="step1" runat="server">
<h1>
Step 1</h1>
<asp:Button ID="GoToStep2" Text="Next" runat="server" OnClick="GoToStep2_Click" />
</asp:Panel>
<asp:Panel ID="step2" runat="server">
<h1>
Step 2</h1>
<asp:Button ID="GoToStep3" Text="Next" runat="server" OnClick="GoToStep3_Click" />
</asp:Panel>
<asp:Panel ID="step3" runat="server">
<h1>
Step 3</h1>
<asp:Button ID="GoToStep4" Text="Next" runat="server" OnClick="GoToStep4_Click" />
</asp:Panel>
<asp:Panel ID="step4" runat="server">
<h1>
Completed</h1>
</asp:Panel>
</div>
</form>
</body>
</html>
Instead of required I am getting this
So can any one tell where I went wrong
Getting some warnings regarding CSS and the error is as follows
Error: document.getElementById("litprogress") is null
I think that the progress bar init is happening before the DOM is fully loaded, put the code inside $(document).ready.
Related
Validation is not working in asp.net webform project for some reason event on a simple test page validation doesnt work, It always returns true and submits the form without validating.
Below is the actual test page i am trying to make it work to know the reason why it is not working.
Could issue be related to some reference issue or wrong library
Same file works in other project but not in this project, did i miss any file or reference.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="en_Test" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rf1" ControlToValidate="TextBox1" ValidationGroup="vgForm" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
<asp:Button ID="Button1" ClientIDMode="Static" runat="server" Text="Button" OnClientClick="return ValidateForm();" ValidationGroup="vgForm" />
</div>
</form>
</body>
<script>
function ValidateForm() {
Page_ClientValidate("vgForm");
if (Page_IsValid) {
alert('it is valid');
return true;
}
else {
alert('No valid');
return false;
}
}
</script>
</html>
I am adding list items to a Bulleted List control.
In the list item i wanted to have the attribute class="" coded.
See code below. class="" is converted to class and the right side ="" is truncated.
Its very important to note that this happens when the scriptmanage/updatepanel is used in the code. otherwise, it seems to be fine.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManagerMain" runat="server" />
<asp:UpdatePanel ID="UpdatePanelMain"
runat="server">
<ContentTemplate>
<asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="LinkButton">
<asp:ListItem Text="One" Value="1" class="active"></asp:ListItem>
<asp:ListItem Text="Two" Value="2" class=""></asp:ListItem>
<asp:ListItem Text="Three" Value="3" class=""></asp:ListItem>
</asp:BulletedList>
<asp:PlaceHolder ID="myplaceHolder" runat="server">
<asp:BulletedList ID="BL_Seasons" runat="server" DisplayMode="LinkButton">
</asp:BulletedList>
</asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Try
class="<%= 1<2?"":"something is wrong"%>"
This should look like class="" in browser.
But some more appropriate thing is to use a different quotation on sides:
class='<%= 1<2?"":"something is wrong"%>'
I tried the following code to the Webform.aspx page:
<asp:Button ID="btnShowAssignLecturer" runat="server"
onclick="btnShowAssignLecturer_Click" Text="Assign Lecturer To Room" />
It says: System.Web.HttpException: Control 'ctl00_head_btnShowAssignLecturer' of type 'Button' must be placed inside a form tag with runat=server.
When I do that, I get another error. Not quite sure what to do.
Master page code:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="AllsWellHospital.Front_End.MasterPage" %>
<!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">
<h1>All Wells Hospital</h1>
<p>
<asp:Label ID="DateDisplay" runat="server"></asp:Label>
</p>
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
<link id="Link1" href="/Styles/StyleSheet2.css" runat="server" rel="stylesheet" type="text/css"/>
<style>
body
{
background-color:#d0e4fe;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="topContent">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="WebForm1.aspx" Text="Web form.aspx" Value="Upload SP10"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
</form>
</body>
</html>
Webform.aspx code:
<%# Page Title="" Language="C#" MasterPageFile="~/Front_End/MasterPage.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AllsWellHospital.Front_End.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Medium"
Text="Course Report"></asp:Label>
<asp:Button ID="btnShowAssignLecturer" runat="server"
onclick="btnShowAssignLecturer_Click" Text="Assign Lecturer To Room" />
</asp:Content>
Your button needs to be within a form tag and currently it isn't. Do you really want to place the button within the head portion of your form? Why not just add another content area for your main content. Try doing something like this:
Master Page:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="AllsWellHospital.Front_End.MasterPage" %>
<!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 id="Head1" runat="server">
<h1>All Wells Hospital</h1>
<p>
<asp:Label ID="DateDisplay" runat="server"></asp:Label>
</p>
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
<link id="Link1" href="/Styles/StyleSheet2.css" runat="server" rel="stylesheet" type="text/css"/>
<style>
body
{
background-color:#d0e4fe;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="topContent">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="WebForm1.aspx" Text="Web form.aspx" Value="Upload SP10"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
</form>
Your aspx:
<%# Page Title="" Language="C#" MasterPageFile="~/Front_End/MasterPage.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AllsWellHospital.Front_End.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Medium"
Text="Course Report"></asp:Label>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Button ID="Button1" runat="server"
onclick="btnShowAssignLecturer_Click" Text="Assign Lecturer To Room" />
</asp:Content>
A button must be placed inside of a server managed <form> tag in order for the post to actually do anything in the ASP pipeline.
However, your content place holder Content1 is inside the <head> tag of the master page, where <form> is invalid. You need to rethink your master page so that this content does not live inside of the <head> element, and include a <form runat='server'> surrounding your form.
You may have meant to use the HTML 5 <header> element, which is distintly different than the normal <head> element.
This is the code I use for my UpdatePanel.
The FileUploadAsync.HasFile() is always null.
I am wondering what is wrong with my asp.net page ...
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="Server" />
<asp:UpdatePanel ID="UpdatePanelAddFiles" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LkUpload" />
</Triggers>
<ContentTemplate>
<asp:LinkButton ID="LkUpload" runat="server" OnClick="LkUpload_Click" Visible="false">Upload</asp:LinkButton>
<ajaxToolkit:AsyncFileUpload runat="server" ID="FileUploadAsync" />
</ContentTemplate>
</asp:UpdatePanel>
Have you tried taking the fileupload outside the update panel? I've had that problem before.
I got this to work, try it out and let me know.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="futest.aspx.cs" Inherits="erpweb.futest" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="smTest" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="upTest" runat="server">
<ContentTemplate>
<ajaxToolkit:AsyncFileUpload ID="AsyncFileUpload1" runat="server"
onuploadedcomplete="AsyncFileUpload1_UploadedComplete" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
codebehind:
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
if (AsyncFileUpload1.HasFile)
{
//do save process here
}
}
I've got a test page put together to display a jQuery Calendar.
It seems like I have created everything correctly, but the Calendar control does not show.
Does anyone see anything wrong with my example below?
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="TestjQuery.aspx.cs" Inherits="AcpSheetMetal.TestjQuery" %>
<!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>jQuery Calendar Test</title>
<link rel="Stylesheet" type="text/css" href="Styles/jquery.ui.datepicker.css" />
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript" />
<script src="Scripts/jquery.ui.datepicker.js" type="text/javascript" />
<script type="text/javascript">
$(function () {
alert("Select Dates and Run Search.");
$("#txtStartDate").datepicker();
$("#txtEndDate").datepicker();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="height:100%;width:100%">
<tr>
<td style="width:20%;">
<asp:Label ID="lblStartDate" runat="server" Text="[Start Date]" /><br />
<asp:TextBox ID="txtStartDate" runat="server" ClientIDMode="Static"></asp:TextBox>
</td>
<td style="width:20%;">
<asp:Label ID="lblEndDate" runat="server" Text="[End Date]" /><br />
<asp:TextBox ID="txtEndDate" runat="server" ClientIDMode="Static"></asp:TextBox>
</td>
<td style="text-align:left;">
Run Search:<br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
It's probably the self closing script tags causing the problem -
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript" />
try using this pattern instead for all the script tags
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
See this question for further info - Why don't self-closing script tags work?
Because you said the alert does not fire I would say that the path Scripts/jquery-1.4.1.min.js could be wrong.
Are you sure this points to your javascript file?
Make sure your paths are correct and close your JavaScript tags:
<link rel="Stylesheet" type="text/css" href='<%= Page.UrlResolve("~/Styles/jquery.ui.datepicker.css" %>' />
<script src='<%= Page.UrlResolve("~/Scripts/jquery-1.4.1.min.js" %>' type="text/javascript"></script>
<script src='<%= Page.UrlResolve("~/Scripts/jquery.ui.datepicker.js" %>' type="text/javascript"></script>
Why don't self-closing script tags work?