how to give print(dot matrix printer) in asp.net - c#

In my project i have to print a form, like name, age etc. Its all printed in print paper, i just have to place name , age according to paper. currently i am using a asp.net page to serve my purpose.where i have put labels with position = absolute. when i click on print i am calling that page , in onload event i am putting label values based on previous page content.
it is simple. so is there any better way to print in dotmatrix printer or not? please suggest.
Now prnting works fine, but problem is when i click on print button i am opening that page like popup window and invoke print there. but i want that pop up window to closed after i click print or cancel button. please help me.
my code is like this:
This BtnPrint is in my main page. Main page contains inputs like name, age and etc.
In PrtPage i have placed labels according to space given for printing.So i am loding main page values in onload event of PrtPage.aspx.
protected void BtnPrint_Click(object sender, EventArgs e)
{
Response.Write("<script>");
Response.Write("window.open('PrtPage.aspx','_blank')");
Response.Write("</script>");
}
in page load of PrtPage:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<script>");
Response.Write("window.print()");
//Response.Write("window.close()");
Response.Write("<script>");
}
but whenever i click on print button it asks ' u want to close window?', so please help me in this. i want to close after i click on print or cancel in print setup window.
or suggest me if there is any good method for printing in dotmatrix..
Thanks in advance.
Sam.

What about using a single page instead of opening a pop window. In the below blog post you can see a example usage. Two div tags with printable and non printable content and the div tag with the printable content is hidden. Then you can use Jquery to print content inside a DIV.
http://itzonesl.blogspot.com/2013/02/how-to-print-content-inside-div-tag.html
Update:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server" >
<title></title>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
 <script src="jquery.printElement.js" type="text/javascript"></script>
<script type="text/javascript">
  function printpage() {
$("#lblName").html($("#TextBox1").val());
$("#lblSchool").html($("#TextBox2").val());
$("#printable").printElement();
}
</script>
<style type="text/css">
#printable { display: none; }
#media print
 {
     #nonprintable { display: none; }
     #printable { display: block; }
 }
</style>
</head>
<body>
<form id="form1" runat="server">
 <div id="nonprintable">
<table class="style1">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>:
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="School"></asp:Label>:
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
     <div id="printable">
<table class="style1">
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Name"></asp:Label>:
</td>
<td>
<asp:Label ID="lblName" runat="server" ></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="School"></asp:Label>:
</td>
<td>
<asp:Label ID="lblSchool" runat="server" ></asp:Label>
</td>
</tr>
</table>
</div>
<asp:Button ID="Button1" runat="server" Text="Print"
OnClientClick="printpage();" />
</form>
</body>
</html>
With MasterPage:
MasterPage.aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<div class="page">
<div class="header">
<div class="title">
<h1>
My ASP.NET Application
</h1>
</div>
<div class="clear hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
</Items>
</asp:Menu>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear">
</div>
</div>
<div class="footer">
</div>
</form>
</body>
</html>
ContentPage.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
 <script src="jquery.printElement.js" type="text/javascript"></script>
<script type="text/javascript">
  function printpage() {
$("#MainContent_lblName").html($("#MainContent_TextBox1").val());
$("#MainContent_lblSchool").html($("#MainContent_TextBox2").val());
$("#printable").printElement();
}
</script>
<style type="text/css">
#printable { display: none; }
#media print
 {
     #nonprintable { display: none; }
     #printable { display: block; }
 }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
 <div id="nonprintable">
<table class="style1">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>:
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="School"></asp:Label>:
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
     <div id="printable">
<table class="style1">
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Name"></asp:Label>:
</td>
<td>
<asp:Label ID="lblName" runat="server" ></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="School"></asp:Label>:
</td>
<td>
<asp:Label ID="lblSchool" runat="server" ></asp:Label>
</td>
</tr>
</table>
</div>
<asp:Button ID="Button1" runat="server" Text="Print"
OnClientClick="printpage();" />
</asp:Content>

The reason you're getting those is that asp.net's scope is limited to the browser window. If the browser is set to ask the user whether they want to close the page when you try to auto-close it (which most appear to be) there's no way of blocking it from the browser.
Same thing with the print, you can't automatically print, because the browser won't let you.

Related

Cannot loop through web form Control in c#

I have a simple web form with some dropdown and textboxes. I am trying to get the value of the all the elements by looping through the control. (note I am assuming that I dont know the name/id of the elements and hence I am trying to loop through them to get the information and store it in a database) However the when I loop through control I get count at 5 even though there are 4 input elements and the control are represented by System.Web.UI.LiteralControl instead of System.Web.UI.WebControls.TextBox or System.Web.UI.WebControls.dropdown
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Datepicker/jquery-1.7.js" type="text/javascript"></script>
<script src="Datepicker/jquery-ui.js" type="text/javascript"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
<script>
$(function () {
$("#targetDueDate").datepicker();
});
</script>
<script>
$(function () {
$("#targetdeliveryoffiles").datepicker();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>Tier:
</td>
<td>
<asp:DropDownList ID="tier" runat="server">
<asp:ListItem>Select Tier</asp:ListItem>
<asp:ListItem>Tier1</asp:ListItem>
<asp:ListItem>Tire2</asp:ListItem>
<asp:ListItem>Tier3</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>Author:
</td>
<td>
<asp:DropDownList ID="author" runat="server">
<asp:ListItem>Select Author</asp:ListItem>
<asp:ListItem>Author1</asp:ListItem>
<asp:ListItem>Author2</asp:ListItem>
<asp:ListItem>Author3</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>Quotation For:
</td>
<td>
<asp:TextBox ID="quotationFor" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Previous Est #:</td>
<td>
<asp:TextBox ID="previousEst" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
ControlToValidate="previousEst"
ValidationExpression="\d+"
Display="Dynamic"
EnableClientScript="true"
ErrorMessage="Please enter numbers only"
runat="server" ValidationGroup="a" ForeColor="Red" />
</td>
</tr>
</table>
<br />
<div style="text-align: center; width: 327px;">
<asp:Button ID="submit" runat="server" Text="Submit" CssClass="btnsubmit" ValidationGroup="a" OnClick="submit_Click" />
</div>
</div>
</form>
</body>
</html>
The onsubmit code
protected void submit_Click(object sender, EventArgs e)
{
foreach(Control c in controls)
{
if(c is System.Web.UI.WebControls.TextBox)
{
/// Do Something
}
}
}
What am i doing wrong ? How do I loop through the element to get their values ? (also the ID since I need to store both in the database)
Everything is a control in web forms; static text is LiteralControl types. So you need to check the type of control as you are and avoid Label, Literal, LiteralControl type of controls, and just look for the controls on your form. Some controls are container controls, so you may need to get into recursion to get this to work.

Unable to get the data from asp:textbox in Jquery popup in code behind

I want to call this Code behind method through a button which is in Jquery popup. But username and password are ended up being NULL
protected void btnSave_Click(object sender, EventArgs e)
{
string strUName= txtNewUname.Text;
string strUpass = txtNewPassword.Text;
}
Here is my Html for the Popup
<body>
<form runat="server">
<input type="button" id="btnNew" text="NEW" value="ADD" onclick="ShowAddNewPopup()"/>
<div id="alertPopup" title="Add New User" style="display :none" >
<table>
<tr>
<td class="auto-style2">UserName
</td>
<td>
<asp:TextBox runat="server" ID="txtNewUname" ClientIDMode="Static"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Password
</td>
<td>
<asp:TextBox runat="server" ID="txtNewPassword" ClientIDMode="Static"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button runat="server" ID="btnSave" OnClick="btnSave_Click" UseSubmitBehavior="false" Text ="save"/>
</td>
</tr>
</table>
</div>
</form>
</body>
Here is my Script to call the popup:
<head runat="server">
<title></title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<script>
function ShowAddNewPopup() {
debugger;
$("#alertPopup").dialog();
}
</script>
</head>
this will work out..
$("#alertPopup").dialog({
appendTo: "form"
});

How do I solve the error "The type 'MasterPage2' already contains a definition for 'head' "

Each time I build my MasterPage.master.aspx, I get an error that reads:
The type 'MasterPage2' already contains a definition for 'head'
This error appears for all the protected values in my MasterPage.master.cs file. How do I fix the error please?
Below is the header for my master page:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage2" %>
And here is my MasterPage.master.cs codes:
using System;
using System.Web;
using System.Web.Profile;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public partial class MasterPage2 : System.Web.UI.MasterPage
{
protected ContentPlaceHolder head;
protected HtmlAnchor A1;
protected HtmlAnchor A2;
protected HtmlAnchor A9;
protected SiteMapDataSource SiteMapDataSource1;
protected Menu MainMenu;
protected HtmlAnchor home;
protected HtmlAnchor A3;
protected HtmlAnchor A4;
protected HtmlAnchor A5;
protected HtmlAnchor A6;
protected HtmlAnchor A7;
protected HtmlAnchor A8;
protected HtmlGenericControl submenu;
protected ScriptManager ScriptManager1;
protected LoginName LoginName1;
protected Literal litbal;
protected Literal litdate;
protected UpdatePanel up12;
protected ContentPlaceHolder content1;
protected ContentPlaceHolder ContentPlaceHolder2;
protected ContentPlaceHolder ContentPlaceHolder3;
protected ContentPlaceHolder ContentPlaceHolder4;
protected Label lblCreatedBy;
protected ContentPlaceHolder ContentPlaceHolder1;
protected HtmlForm form1;
protected DefaultProfile Profile
{
get
{
return (DefaultProfile)this.Context.Profile;
}
}
protected HttpApplication ApplicationInstance
{
get
{
return this.Context.ApplicationInstance;
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.litdate.Text = DateTime.Now.ToString("D");
if (((object)this.Page.User.Identity.Name).ToString() != "")
this.litbal.Text = DB.ExecuteScaler(string.Format("Select Agent_current_bal from AgentBasicInfo where Agent_ID='{0}'", (object)((object)this.Page.User.Identity.Name).ToString().ToLower())).ToString();
else
this.up12.Visible = false;
this.submenu.Visible = ((object)this.Page.User.Identity.Name).ToString() == "admin";
this.lblCreatedBy.Text = "Created By: otieno t oloo";
}
}
Below here is my MasterPage.master.aspx codes:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage2" %>
<!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>Untitled Page</title>
<link href="css/Style.css" rel="stylesheet" type="text/css" media="all" />
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="container">
<!--header starts -->
<div id="header">
<div id="logo">
<img src="~/Images/logo.gif" alt="logo" runat="server" /></div>
<div id="logoright">
<div id="topbar1" style="float: right">
<div class="empty" style="padding-top:3px; padding-right: 10px; background: #f1f1f1; height: 25px">
<a id="A1" href="~/Agent_list.aspx" runat="server">Agents</a>| About Us| <a id="A2" href="~/Faq.aspx" runat="server" >FAQ</a>| <a id="A9" href="~/Feedback.aspx" runat="server">Feedback</a>|
Contact Us</div>
<div class="empty" style="background: #f1f1f1">
<img height="25" alt="" src="~/Images/top_curve2.gif" width="32" runat="server" /></div>
<div class="empty" style="width: auto; height: 25px; text-align: center">
</div>
</div>
<div class="empty" style="float: right; margin: 9px 0px 8px; ">
<img height="56" alt="" src="~/Images/paper.gif" width="286" runat="server" /><asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />
</div>
<div id="navigation">
<div>
<asp:Menu ID="MainMenu" runat="server" Orientation="Horizontal" MaximumDynamicDisplayLevels="0"
DataSourceID="SiteMapDataSource1" DynamicEnableDefaultPopOutImage="False" StaticEnableDefaultPopOutImage="False">
<StaticMenuStyle CssClass="menu" />
<StaticMenuItemStyle CssClass="menuItem" />
<StaticSelectedStyle CssClass="menuSelectedItem" />
<DynamicMenuStyle CssClass="menuPopup" />
<DynamicMenuItemStyle CssClass="menuPopupItem" Font-Strikeout="False" />
<DynamicHoverStyle CssClass="menuPopupItem" />
<StaticHoverStyle CssClass="menuItemHover" />
</asp:Menu>
</div>
<div id="submenu" runat="server">
<ul id="submenulist">
<li><a id="home" href="~/AdminArea/HomeForAdmin.aspx" runat="server">Basic Info</a></li>
<li><a id="A3" href="~/AdminArea/CreateAgent.aspx" runat="server">Create Agent</a></li>
<li><a id="A4" href="~/AdminArea/All_Agents_info.aspx" runat="server">Agent List</a></li>
<li><a id="A5" href="~/AdminArea/Deposit.aspx" runat="server">Deposite</a></li>
<li><a id="A6" href="~/AdminArea/Agent_search.aspx" runat="server">Search Agent</a></li>
<li><a id="A7" href="~/AdminArea/Bus_list.aspx" runat="server">Bus List</a></li>
<li><a id="A8" href="~/AdminArea/feedback_list.aspx" runat="server">FeedBack List</a></li>
</ul>
</div>
</div>
</div>
</div>
<div>
<table style="width: 100%;">
<tr>
<td colspan="3">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="up12" runat="server">
<ContentTemplate>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td class="border-header" style="height: 25px;" valign="middle"
align="left" width="600">
Welcome <asp:LoginName ID="LoginName1" runat="server" />, Rs.<asp:Literal ID="litbal" runat="server" />
</td>
<td class="border-header-date" style="height: 25px" valign="middle" align="left"
width="200">
<asp:Literal ID="litdate" runat="server"></asp:Literal>
</td>
</tr>
</tbody>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:ContentPlaceHolder ID="content1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td colspan="3">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td colspan="3">
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td colspan="3">
<asp:ContentPlaceHolder ID="ContentPlaceHolder4" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>
<div id="footer">
<div id="footerlinks">
<div style="float: left">
Copyright © 2010, All rights reserved <span class="orange11">l</span> Privacy policy <span class="orange11">
l</span> Terms and conditions
<br />
</div>
<div style="float: right; text-align: right">
<asp:Label ID="lblCreatedBy" runat="server"></asp:Label>
</div>
</div>
<!--footer ends -->
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</div>
</form>
</body>
</html>
There might be a few reasons:
You have another class somewhere in your project that is also called MasterPage2
You need to clean and rebuild your project
You have a control named head in you master.cs and a control with the same name in your master.designer.cs
Are you nesting MasterPages?.
IF so the error is pointing to the cause. You have 2 head elements in the resulting page (combined). Aside from the server-side error, you'll likely have a malformed HTML document that gets rendered (2 sets of <html/> declarations and <head/>, <body/>, etc. elements).
Refer to this MSDN document on how to nest MasterPages. In a nutshell, the nested MasterPage is like a "templated" UserControl.
Hth...

Update Progress is not working in Login page

I am using Update Progress in my Login page. Here when a user is clicking on btnLogin, it is validating the user and doing some database insertion and lastly redirecting to Home Page.
I am using the same Update progress in other pages in my project and its working fine but in this page it is not working.Please guide me that what mistake i am doing here.
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Employee Quotient</title>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
try {
window.history.forward();
function noBack() { window.history.forward(); }
} catch (err) { }
</script>
</head>
<body onload="noBack();" onpageshow="if (event.persisted) noBack();" onunload="">
<form id="MyForm" method="post" runat="server">
<asp:ScriptManager ID="ScriptManger1" runat="server" EnablePartialRendering="false" />
<asp:UpdatePanel runat="server" ID="updLogin">
<ContentTemplate>
<div id="container">
<div id="header">
<div id="logo">
<div id="Div1">
<h1 style="color: White;">
EQ
</h1>
</div>
</div>
<div class="topright">
<table>
<tr>
<td height="15px">
<strong></strong>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtUserID" runat="server" ToolTip="Employee Code" Font-Names="Calibri"
Font-Size="12px"></asp:TextBox>
<ajaxToolkit:TextBoxWatermarkExtender ID="TBWE2" runat="server" TargetControlID="txtUserID"
WatermarkCssClass="WaterMarkedTextBox" WatermarkText="ECode" />
</td>
<td>
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" ToolTip="Password"
Font-Names="Calibri" Font-Size="12px"></asp:TextBox>
<ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
TargetControlID="txtPassword" WatermarkCssClass="WaterMarkedTextBoxPSW" WatermarkText="*" />
</td>
<td>
<asp:Button ID="btnLogin" runat="server" CssClass="buttonlogint" OnClick="btnLogin_Click"
Text="Login" />
</td>
</tr>
<tr>
<td>
<asp:HyperLink ID="HyperLink1" runat="server" ForeColor="#6666FF" NavigateUrl="~/Account/ForgotPassword.aspx"
Style="color: White; font-family: calibri; font-size: 10pt; background-color: transparent;">Forgot Password</asp:HyperLink>
</td>
<td width="200px">
<asp:Label ID="lblError" runat="server" Font-Bold="true" Text="Password " ForeColor="White"
Visible="false" />
</td>
</tr>
<tr>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserID"
ErrorMessage="* UserID can't be left blank" Font-Bold="false" Style="display: none;
font-family: Calibri" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPassword"
ErrorMessage="* Password can't be left blank" Font-Bold="True" Style="display: none;" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</div>
</div>
<div id="menulogin">
</div>
<div class="contentplaceholder">
<div id="single-column">
<h1>
&nbsp About EQ
</h1>
<p class="justify">
&nbsp Your partner in Productivity improvement.</p>
</div>
<div style="height: 515px;">
<h1>
</h1>
<p class="justify">
<strong>&nbsp &nbsp"</strong>&nbsp &nbsp &nbsp &nbsp &nbsp *** More coming up here..keep
watching this space ***&nbsp &nbsp &nbsp &nbsp &nbsp<strong>"</strong>
</p>
</div>
</div>
<div id="footer">
<div id="footer-left">
</div>
<div id="footer-right">
</div>
<div id="footer-content">
<div id="footer-navigation">
</div>
<p>
Copyright © All rights reserved.</p>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnLogin" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="txtUserID" />
<asp:AsyncPostBackTrigger ControlID="txtPassword" />
</Triggers>
</asp:UpdatePanel>
<div class="divTextAlign">
<asp:UpdateProgress ID="updProgressForLogin" runat="server" DynamicLayout="true" associatedupdatepanelid="updLogin"
>
<ProgressTemplate>
<table border="1px">
<tr>
<td>
<img src="../images/faismall_logo.jpg" alt="" />
</td>
</tr>
<tr>
<td>
<img src="../images/ajax-loader.gif" alt="" />
</td>
</tr>
</table>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</form>
</body>
</html>
Try this
<asp:ScriptManager ID="ScriptManger1"
runat="server"
EnablePartialRendering="true" />
Instead of this
<asp:ScriptManager ID="ScriptManger1"
runat="server"
EnablePartialRendering="false" />
I am not very much sure but please check the reference names and spells are ok
<asp:UpdateProgress ID="updProgressForLogin" runat="server" DynamicLayout="true" associatedupdatepanelid="updLogin"
>

asynccontrols asp.net Error Creating Control " Object reference not set to an instance of an object"

here is my sample form.
I'm using asynccontrols
. Site compiles fine, loads fine, works fine. Can't view anything in designer. Halp?
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Calendar2.aspx.cs" Inherits="txssaAuction.Calendar2" %>
<%# Register Assembly="AsyncControls" Namespace="DelvingWare.AsyncControls" TagPrefix="dw" %>
<!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>
<dw:asynccalendar runat="server" ID="calMain"
DefaultStyle="false"
AbbreviateDays="true"
PreviousMonthText="<div class='navPrev' title='Previous Month'><<<</div>"
NextMonthText="<div class='navNext' title='Next Month'>>>></div>"
SelectedDayCssClass="selDay"
CssClass="asyncCalReg"
WeekendDayCssClass="weekend"
OtherMonthCssClass="otherMonth"
DayCssClass="calday"
Width="500"
MonthListCssClass="monthList"
YearListCssClass="yearList"
TodayCssClass="today"
TodayFooterCssClass="todayFooter"
DaySelectionMode="Multiple"
OnDaySelected="calMain_DaySelected"
MonthSelectorCssClass="monthSelector"
YearSelectorCssClass="yearSelector" />
<p>
<dw:asynclistbox runat="server" ID="lstMain"
SelectionMode="Single"
OnSelectedIndexChanged="lstMain_IndexChanged"
Rows="7">
<AsyncListItem Text="No Selected Dates" Value="none" />
</dw:asynclistbox>
<br/>
<dw:asynclinkbutton runat="server" ID="lnkMain"
ConfirmMessage="Are you sure you want to clear all selected dates?"
OnClick="lnkMain_Click">Clear Selected Dates</dw:asynclinkbutton>
</p>
</p>
<dw:AsyncRepeater ID="rptUsers" runat="server"
OnItemDataBound="rptUser_ItemDataBound"
EnableEffects="true"
RollACssClass="rollA"
RollBCssClass="rollB"
HighlightCssClass="highlight"
CssClass="asyncRep"
Visible="true">
<HeaderTemplate>
<table cellpadding="4">
<tr class="headlnk">
<td>
First Name
</td>
<td>
Last Name
</td>
<td>
Account Balance
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr $roll$ $highlight$>
<td>
<dw:AsyncLiteral runat="server" ID="ltlFirstName" />
</td>
<td>
<dw:AsyncLiteral runat="server" ID="ltlLastName" />
</td>
<td>
<dw:AsyncLiteral runat="server" ID="ltlAccBalance" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</dw:AsyncRepeater>
<br />
<dw:AsyncButton runat="server" ID="btMain"
OnClick="btMain_Click"
CssClass="greyButton">Re-Bind the AsyncRepeater</dw:AsyncButton>
</div>
</form>
</body>
</html>

Categories