Complete border on page of print of Web page - c#

I am having a web page and on button of print.
when i click on that button i am trying to print that web page
Here is my button
<asp:ImageButton ID="ImageButton1" runat="server" ToolTip="Cancel" AlternateText="Print"
ImageUrl="~/admin/images/print_btn.png" OnClientClick='javascript:window.print();' />
My web page contains more than 3 print page. I have set a border on Media Print.
but it is not working properly.
there is only one bottom border that is at the last page.
I need borders on each page of print.
Is it possible using javascript or jquery?
if it is possible using c# then also let me know
here is my code
<style type="text/css">
#media print
{
.TblBorder
{
border-collapse: collapse;
border: solid 1px black;
}
.TblBorder td
{
border: solid 1px black;
}
.TblBorder th
{
border: solid 1px black;
}
}
</style>
<table width="100%" cellpadding="8" cellspacing="2">
<tr class="printable">
<td colspan="3" align="center" style="color: Black; font-family: Calibri; font-size: 18px;
font-weight: bold">
<asp:Label ID="lblHeading" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr class="non-printable" visible="false" runat="server" id="trPrintPlantandMachinery">
<td colspan="3" align="left">
<asp:LinkButton ID="lnkbtnPlantMachinery" runat="server" CssClass="left_panel" Text="<b>1. Download & Print Plant & Machinery List</b>"
OnClick="lnkbtnPlantMachinery_Click" Font-Underline="true"></asp:LinkButton>
</td>
</tr>
<tr class="printable">
<td style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;"
width="49%">
Date of Visit the Enterprise
</td>
<td style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;"
width="1%">
:
</td>
<td width="50%" style="font-family: calibri; font-size: 15px; font-weight: bold;">
<asp:Label ID="txtDateofVisit" runat="server"></asp:Label>
</td>
</tr>
<tr class="printable">
<td style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;"
width="49%">
Application Number
</td>
<td style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;"
width="1%">
:
</td>
<td width="50%" style="font-family: calibri; font-size: 15px; font-weight: bold;">
<asp:Label ID="lblApplicationNo" runat="server" Text="-"></asp:Label>
</td>
</tr>
<tr class="printable">
<td width="49%" style="font-family: calibri; font-size: 14px; font-weight: bold;
color: Black;">
Scheme Name
</td>
<td width="1%" style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;">
:
</td>
<td width="50%" style="font-family: calibri; font-size: 15px; font-weight: bold;">
<asp:Label ID="lblSchemeName" runat="server"></asp:Label>
</td>
</tr>
<tr class="printable">
<td width="49%" style="font-family: calibri; font-size: 14px; font-weight: bold;
color: Black;">
Name of Enterprise
</td>
<td width="1%" style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;">
:
</td>
<td width="50%" style="font-family: calibri; font-size: 15px; font-weight: bold;">
<asp:Label ID="lblUnitName" runat="server" Text="-"></asp:Label>
</td>
</tr>
<tr class="printable">
<td width="49%" style="font-family: calibri; font-size: 14px; font-weight: bold;
color: Black;">
Enterprise Address
</td>
<td width="1%" style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;">
:
</td>
<td width="50%" style="font-family: calibri; font-size: 15px; font-weight: bold;">
<asp:Label ID="lblIndustryUnitAddress" runat="server" Text="-"></asp:Label>
</td>
</tr>
</table>
<table width="100%" cellpadding="5" cellspacing="2" border="0">
<tr>
<td style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;"
width="49%">
Constitution of The Unit
</td>
<td style="font-family: calibri; font-size: 14px; font-weight: bold; color: Black;"
width="1%">
:
</td>
<td width="50%" style="font-family: calibri; font-size: 15px; font-weight: bold;">
<asp:Label ID="lblConstitutionUnit" runat="server" Text="-"></asp:Label>
</td>
</tr>
<tr>
<td style="font-family: calibri; font-size: 16px; font-weight: bold; color: Black"
colspan="3">
<u>Entrepreneur's Profile Details</u>
</td>
</tr>
</table>

Related

text/plain version of multipart email sent with mailkit not being received correctly

I am using mimekit and mailkit to build a multi part email that contains an html body and a plain text body. The html version works fine. The plain text works fine but only when the html is not included.
When I build a multi part email that contains both text and html bodies it seems like only the html is received on both outlook and gmail. If I set my mail to only plain-text then I get text parsed out of the html body. I have looked at the original in gmail and decoded it to find it is the parsed html not the separate plain text version I am trying to send with mailkit.
Here is the code that is building and sending the email.
public void SendEmail(List<string> toAddresses, string fromAddress, string subject, string htmlBody, string textBody)
{
var message = new MimeMessage();
message.From.Add(new MailboxAddress(fromAddress));
foreach (var to in toAddresses)
{
message.To.Add(new MailboxAddress(to));
}
message.Subject = subject;
var bodyBuilder = new BodyBuilder
{
HtmlBody = htmlBody,
TextBody = textBody
};
message.Body = bodyBuilder.ToMessageBody();
_smtpClient.Connect(_settings.SmtpHostServer, _settings.SmtpPortNumber);
_smtpClient.Authenticate(_settings.SmtpUserName, _settings.SmtpUserPassword);
_smtpClient.Send(message);
_smtpClient.Disconnect(true);
}
When I write the message to a file it is in mime format, and has separate sections for html and plain text with the content I expect for each section.
From: ************
Date: Mon, 23 Sep 2019 09:10:35 -0600
Subject: Welcome To ************
Message-Id: <FVVQHEHRM8U4.J4JDCO9VD6OS2#localhost.localdomain>
To: ************
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="=-YWTR3eTYkSy366wQ3CLhlw=="
--=-YWTR3eTYkSy366wQ3CLhlw==
Content-Type: text/plain; charset=utf-8
=================================================================================
Welcome to ************
=================================================================================
You are receiving this email because you have registered with *****.
Please copy the following URL below into your web browser to login to *******.
https://************/login
Sincerely,
The ******* Team
=================================================================================
******** Contact Information
=================================================================================
Email: ************
Phone: ***********
--=-YWTR3eTYkSy366wQ3CLhlw==
Content-Type: text/html; charset=utf-8
Content-Id: <6MLWHEHRM8U4.ZO5T7EVTEFZ42#localhost.localdomain>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">
/* FONTS */
#media screen {
#font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 400;
src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff');
}
#font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 700;
src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v11/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format('woff');
}
#font-face {
font-family: 'Lato';
font-style: italic;
font-weight: 400;
src: local('Lato Italic'), local('Lato-Italic'), url(https://fonts.gstatic.com/s/lato/v11/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format('woff');
}
#font-face {
font-family: 'Lato';
font-style: italic;
font-weight: 700;
src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(https://fonts.gstatic.com/s/lato/v11/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format('woff');
}
}
/* CLIENT-SPECIFIC STYLES */
body, table, td, a {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
table, td {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
img {
-ms-interpolation-mode: bicubic;
}
/* RESET STYLES */
img {
border: 0;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
}
table {
border-collapse: collapse !important;
}
body {
height: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
}
/* iOS BLUE LINKS */
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
/* MOBILE STYLES */
#media screen and (max-width:600px) {
h1 {
font-size: 32px !important;
line-height: 32px !important;
}
}
/* ANDROID CENTER FIX */
div[style*="margin: 16px 0;"] {
margin: 0 !important;
}
</style>
</head>
<body style="background-color: #f4f4f4; margin: 0 !important; padding: 0 !important;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<!-- LOGO -->
<tr>
<td bgcolor="#539be2" align="center">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td align="center" valign="top" style="padding: 50px 20px 50px 20px;">
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<!-- HERO -->
<tr>
<td bgcolor="#539be2" align="center" style="padding: 0px 10px 0px 10px;">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="center" valign="top" style="padding: 40px 20px 20px 20px; border-radius: 4px 4px 0px 0px; color: #111111; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; letter-spacing: 4px; line-height: 48px;">
<h1 style="font-size: 48px; font-weight: 400; margin: 0;">Welcome to ********</h1>
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<!-- COPY BLOCK -->
<tr>
<td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<!-- COPY -->
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 10px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p>
You are receiving this email because you have registered with *********.
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 30px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#539be2">
<a href="https://**********/login" target="_blank" style=" border-radius: 3px; font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #539be2; display: inline-block;">
Login To *********
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>Sincerely,</p>
<p>The ******** Team</p>
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<!-- FOOTER -->
<tr>
<td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<!-- NAVIGATION -->
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 30px 30px 30px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;">
<p style="margin: 0;">
**********
</p>
<p style="margin: 0;">
(866) 571-5014
</p>
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
</body>
</html>
--=-YWTR3eTYkSy366wQ3CLhlw==--
Sounds like bugs in GMail and Outlook. The raw MIME looks fine. There's absolutely nothing wrong with it.

asp.net gridview template field with second row spanning mutiple columns

Good Afternoon,
I would like to know if this is possible. I have a gridview with several (4 template fields). The 4 fields include
First Name
Last Name
Phone
Email
What I would like to do is get a fifth data column(address) completely on a different row so that the data looks like this.
Row #1 | First Name | Last Name | Phone | Email| Record #1
Row #2 | Address | Record #1
Row #3 | First Name | Last Name | Phone | Email| Record #2
Row #4 | Address | Record #2
Can anybody help me with this, please?
For some reason this question is upvoted. I will wrote you an answer:
<table>
<asp:Repeater runat="server" ID="repeater1" >
<ItemTemplate>
<tr>
<td> <%#Eval("FirstName")%></td>
<td> <%#Eval("LastName")%></td>
....//other <td></td>
</tr>
<tr>
<td><%#Eval("Address")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
I will leave for you the css part, also if you want to have column names look into <th> tags, but I don't know how you will achieve that properly when you have on row 1 columns different form row 2. If you want to have delete/edit functionality you should add new td with linkButton/ImageButton/Button with functionality which will delete/edit the current row. For this you will need <%#Eval("ID")%> in CommandArguments of the button. But again in this case this will be interesting because you have one record on 2 rows. The design decision is done by you this is the solution.
You should probably look how to have multiple columns on row 1 and only one on row 2, this was attribute of td colspan
In code behind:
repeater1.DataSource = dst; // this should be data set containing all the needed values
repeater1.DataBind();
I'm not sure why it isn't more common knowledge that you can do this in a GridView. You can mix and match spanned rows and throw some regular GridView columns on at the end of the span (bound or templated).
You do lose some of the bells and whistles of the GridView, because you will have to manually handle sorting and some of the other things that make the GridView easy to work with. But unlike the Repeater, you still get some of the extra functionality of the GridView.
If you throw together a datasource that matches the fields I'm binding to here, you will see it has a second row that spans multiple columns (all the way to the last templated column of the GridView).
It's basically a header template, Two HTML tables, and then whatever type of GridView columns you need after that, if any at all.
The first html table is the normal row. The second html table is the just a long row to put something like a long description or notes.
Didn't include the CSS here, but that's how you will format column widths and alignment.
Works fine, but it sure takes longer to build these. You have to spend a lot of time adjusting column widths, and it is a pain to get the header column to match up with row columns. But, not much different than what you would run into making a template for a repeater.
<asp:GridView ID="GridView2" AutoGenerateColumns="False" runat="server" >
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<table id="Table1" runat="server" >
<tr id="Tr1" runat="server" >
<td id="Td1" style="width: 55px; text-align: center; vertical-align: bottom; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lbPoNoSort" CommandArgument="id" CommandName="Sort" runat="server">ID#</asp:LinkButton></td>
<td id="Td2" style="width: 85px;" runat="server">
<asp:LinkButton ID="lbDateRequested" CommandArgument="ReqDate" CommandName="Sort" runat="server">Date</asp:LinkButton></td>
<td id="Td3" style="width: 100px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lblNameSort" CommandArgument="col2" CommandName="Sort" runat="server">Name</asp:LinkButton></td>
<td id="Td4" style="width: 130px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lblApprovSort" CommandArgument="approved_by" CommandName="Sort" runat="server">User</asp:LinkButton></td>
<td id="Td5" style="width: 175px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lbVendorSort" CommandArgument="vendor" CommandName="Sort" runat="server">Vendor</asp:LinkButton></td>
<td id="Td7" style="width: 150px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lbTypeSort" CommandArgument="col4" CommandName="Sort" runat="server">Type</asp:LinkButton></td>
<td id="Td8" style="width: 65px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lbNoSort" CommandArgument="col5" CommandName="Sort" runat="server">OrderNo</asp:LinkButton></td>
<td id="Td9" style="width: 90px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lbCostSort" CommandArgument="col6" CommandName="Sort" runat="server">Est. Cost</asp:LinkButton></td>
<td id="Td10" style="width: 75px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lbPaymentTypeSort" CommandArgument="col10" CommandName="Sort" runat="server">Payment Type</asp:LinkButton></td>
<td id="Td11" style="width: 75px; text-align: center; vertical-align: bottom; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:LinkButton ID="lbLocationSort" CommandArgument="col7" CommandName="Sort" runat="server">Inventory Location</asp:LinkButton></td>
<td id="Td12" style="width: 75px; text-align: center; vertical-align: bottom; border-left: solid 1px black;" runat="server">
<asp:LinkButton ID="lbDeliverySort" CommandArgument="col13" CommandName="Sort" runat="server">Delivery Method</asp:LinkButton></td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table >
<tr>
<td style="width: 55px; text-align: center; vertical-align: top; border-right: solid 1px black;">
<asp:Label ID="Label7" runat="server" Visible="false" Text='<%# Bind("id") %>'></asp:Label>
<asp:LinkButton ID="lbPoNo" CommandName="View" runat="server" Visible="true" Text='<%# Bind("id") %>' ></asp:LinkButton>
</td>
<td style="width: 85px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("Date")%>' >
</asp:Label>
</td>
<td style="width: 100px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;">
<asp:Label ID="Label3" runat="server" Text='<%# Eval("col1")%>' >
</asp:Label>
</td>
<td style="width: 130px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;">
<asp:Label ID="Label4" runat="server" Text='<%# Eval("col2")%>' >
</asp:Label>
</td>
<td style="width: 175px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;">
<asp:Label ID="Label5" runat="server" Text='<%# Eval("col3")%>' >
</asp:Label>
</td>
<td style="width: 150px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;">
<asp:Label ID="Label6" runat="server" Text='<%# Eval("col4")%>' >
</asp:Label>
</td>
<td style="width: 65px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;">
<asp:LinkButton ID="lbOrderNo" runat="server" CommandName="ViewOrder" Text='<%# DataBinder.Eval(Container.DataItem, "col5") %>'></asp:LinkButton>
</td>
<td style="width: 90px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:Label ID="Label8" runat="server" Text='<%# Eval("col6")%>' >
</asp:Label>
</td>
<td style="width: 75px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;" runat="server">
<asp:Label ID="Label9" runat="server" Text='<%# Eval("col7")%>' >
</asp:Label>
</td>
<td style="width: 75px; text-align: center; vertical-align: top; border-left: solid 1px black; border-right: solid 1px black;">
<asp:Label ID="Label10" runat="server" Text='<%# Eval("col8")%>' >
</asp:Label>
</td>
<td style="width: 75px; text-align: center; vertical-align: top; border-left: solid 1px black;">
<asp:Label ID="Label11" runat="server" Text='<%# Eval("col9")%>' >
</asp:Label>
</td>
</tr>
</table>
<table class="job-info">
<tr class="TableData">
<td style="width: 1100px">
<asp:Label ID="Label13" CssClass="details" runat="server" Text="Details:" ></asp:Label> <asp:Label ID="Label12" BackColor="WhiteSmoke" runat="server" Text='<%# Eval("col10")%>' >
</asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="True" HeaderText="Accounting">
<ItemTemplate>
<asp:CheckBox ID="check" runat="server" Enabled="False" />
</ItemTemplate>
<HeaderStyle Width="60px" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>

How to Reopen pure CSS3 modal dialog

I have following Modal Dialog (popup) using only CSS3 in my asp page for user registration:
HTML :
<%-- Modal PopUp starts here--%>
<div id="openModal" class="modalDialog">
<div> X
<table style="width:100%;">
<tr>
<td style="text-align: center; width: 100%;"></td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<asp:Label ID="lblErrorMSG2" runat="server" Font-Bold="True" ForeColor="#FF3300" Text="Email ID Already Taken " Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustFName" name="txtCustFName" type="text" required placeholder="Enter Your First Name" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustLName" name="txtCustLName" type="text" required placeholder="Enter Your Last Name" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustREmail" name="txtCustREmail" type="email" required placeholder="Enter Valid Email ID" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustRPwd" name="txtCustRPwd" type="password" required placeholder="Enter Password" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustRePwd" name="txtCustRePwd" type="password" required placeholder="ReType Password" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;">
<input id="txtCustPh" name="txtCustPh" type="number" size="10" min="10" max="10" required placeholder="Enter Valid Mobile No" style="width: 80%" />
</td>
</td>
</tr>
<tr>
<td class="style1" style="text-align: center; width: 100%;" onclick="btnSignUp()">
<asp:Button ID="btnSingUp" runat="server" onclick="signUp" Text="Login" />
</td>
</tr>
<tr>
<td style="text-align: center; width: 100%;"> </td>
</tr>
</table>
</div>
</div>
<%--Modal PopUp Ends Here--%>
CSS :
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 400px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;}
.close:hover { background: #00d9ff;
}
In my asp page I've following anchor tag which is used to display the popup:
Register
Now the problem is:
As this is registration form, I want server side validation of existing email id .
If user entered email id already exist in DB I want to reopen the above modal dialog with an error message Email ID already exist.
I m not able to reopen that dialog box.
Is there any way to do this using js?
Plz help me.
The tutorial for modal dialog is on site:
click here
For visualizing modal dialog:
click here
Thanx in advance.
for server side validation I suggest you to use javascript web method for this. By using this web method your popup didn't close while page check server side validation.....
Change the :target to also accept a class:
.modalDialog:target, .modalDialog.target {
opacity:1;
pointer-events: auto;
}
And then when you find out the email is invalid, you can just do:
$('.modalDialog').addClass('target')
or the non-jquery equivalent.

Webcontrols from a repeater control loose their value

It seams that the solution for this problem would be what it is said in this post: http://codinglifestyle.wordpress.com/2009/10/08/repeaters-and-lost-data-after-postback-viewstate/ however it seams that for me does not work :|
So I have a page and in that page a repeater that has 3 webcontrols.
<asp:Repeater ID="repFissaggio" runat="server" OnItemCreated="repFissaggio_ItemCreated" EnableViewState="true" >
<ItemTemplate>
<table width="100%">
<tr>
<td style="width:30%;border: gray 1px solid;">
<div style="text-align: center; width:100%; border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;border-bottom: gray 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-WEIGHT: bold; FONT-SIZE: 12px; background-color:gainsboro;">Disegno Articolo</div>
<asp:Image runat="server" ImageUrl='<%# GetFileAddress(Container.DataItem) %>' Width='220px' ID="imgDisegnoArt" EnableViewState="false"></asp:Image>
</td>
<td style="width:65%">
<div style="text-align: center; width:100%; border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;border-bottom: gray 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-WEIGHT: bold; FONT-SIZE: 12px; background-color:gainsboro;">Informazioni Articolo</div>
<gsc:SchSolettoFinissaggioArticoloUC ID="ucSchSolettoFinissaggioArticolo" runat="server"></gsc:SchSolettoFinissaggioArticoloUC>
</td>
</tr>
<tr>
<td style="border: gray 1px solid;">
<div style="text-align: center; width:100%; border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;border-bottom: gray 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-WEIGHT: bold; FONT-SIZE: 12px; background-color:gainsboro;">Schema Finissaggio</div>
<asp:Image runat="server" ImageUrl='<%# GetFileAddress(Container.DataItem) %>' Width='220px' ID="imgSchedaFissaggio" EnableViewState="false"></asp:Image>
<asp:Label ID="divfileName" runat="server" Text='<%# GetFileName(Container.DataItem) %>' style="text-align: center; width:100%"></asp:Label>
</td>
<td>
<fieldset style="padding: 10px,10px,10px,10px; border-bottom-width: 5px">
<legend>Sistema di Industrializzazione</legend>
<gsc:SchSolettoSistemaProdIndusUC ID="ucSchSolettoSistemaIndus" runat="server"></gsc:SchSolettoSistemaProdIndusUC>
</fieldset>
<br />
<fieldset style="padding: 10px,10px,10px,10px; border-bottom-width: 5px">
<legend>Sistema di Produzione</legend>
<gsc:SchSolettoSistemaProdIndusUC ID="ucSchSolettoSistemaProd" runat="server"></gsc:SchSolettoSistemaProdIndusUC>
</fieldset>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
On init I call this method
protected override void InitEditor()
{
if (!IsPostBack)
{
...
repFissaggio.DataSource = SolettoDS.SoleXSchTec;
repFissaggio.DataBind();
}
}
Above this repeater I have other webcontrols. When I change a value of a dropdown the form is submitted. When that happens values of webcontrol from repeater looses their value.
What do you suggest to do?
Thanks.
I found the answer: I should put binding in protected void repFissaggio_ItemDataBound(object sender, RepeaterItemEventArgs e) and not in repFissaggio_ItemCreated

Implement a html-widget (form) into an asp-site

I try to implement the following widget in my asp.net-site:
<div style="width: 175px; margin: 0px; padding: 0px; text-align: right; background-color:#FFFFFF;">
<img src="http://fahrplan.sbb.ch/img/igm-sbblogo.gif" width="110" height="18" alt="SBB|CFF|FFS" />
<h1 style="width:175px; background-color: #DDDDDD; color: #000000; font-family: Arial, Helvetica, sans-serif; font-size:12px; font-weight: bold; padding: 2px 0px; margin: 0; height: 15px; text-align: left;clear:both;"> Fahrplan</h1>
<div style="width: 100%; background-color: #F8F8F8; margin: 0; padding: 0px;" summary="Layout">
<form action="http://fahrplan.sbb.ch/bin/query.exe/dn?externalCall=yes&DCSext.wt_fp_request=partner_mini" name="formular" method="post" style="display:inline" target="_blank">
<input type="hidden" name="queryPageDisplayed" value="yes">
<table cellspacing="0" cellpadding="4" style="width: 170px; margin: 2px;" class="ig">
<tr>
<th nowrap="nowrap" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; font-weight:bold; width: 55px;">
Von:
</th>
<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; padding:2px 3px 2px 0px;" colspan="2">
<input type="hidden" name="REQ0JourneyStopsSID" value="A=1#O=Stettbach, Bahnhof#X=8596132#Y=47397270#U=85#L=008591065#B=1#p=1338878028#">
<span style="font-weight:bold;">Stettbach, Bahnhof</span>
</td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; padding:2px 3px 2px 0px;">
<select name="REQ0JourneyStopsZA" style="background-color:#fff; border: 1px solid #7F9DB9; color: #000; width: 60px; font-size:11px; margin:0px 0px;">
<option selected="selected" value="7">Nach:</option>
<option value="1">Bhf./Haltest.</option>
<option value="2">Ort, Strasse Nr.</option>
<option value="4">Sehenswürdigkeit</option>
</select>
</td>
<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; padding:2px 3px 2px 0px;" colspan="2">
<input type="text" name="REQ0JourneyStopsZG" value="" size="16" style="background-color:#fff; border: 1px solid #7F9DB9; color: #000; width: 100px; height: 18px; font-size: 11px" accesskey="t" tabindex="2">
<input type="hidden" name="REQ0JourneyStopsZID">
</td>
</tr>
<tr>
<th nowrap="nowrap" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; font-weight:bold; width: 55px;">
Datum:
</th>
<td nowrap="nowrap" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; padding:2px 3px 2px 0px;">
<b>08.06.12</b>
<input type="hidden" name="REQ0JourneyDate" value="08.06.12" accesskey="d">
</td>
</tr>
<tr>
<th nowrap="nowrap" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; font-weight:bold; width: 55px;">
Zeit:
</th>
<td nowrap="nowrap" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; padding:2px 3px 2px 0px;">
<input type="text" name="REQ0JourneyTime" value="11:02" size="5" maxlength="5" style="background-color:#fff; border: 1px solid #7F9DB9; color: #000; width: 100px; height: 18px; font-size: 11px" accesskey="c" tabindex="4">
</td>
</tr>
<tr>
<th> </th>
<td nowrap="nowrap" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; vertical-align:middle; padding:2px 3px 2px 0px;">
<input class="radio" type="radio" name="REQ0HafasSearchForw" value="1" checked style="margin-right:3px;">Abfahrt
<br /><input class="radio" type="radio" name="REQ0HafasSearchForw" value="0" style="margin-right:3px;">Ankunft
</td>
</tr>
<tr>
<td colspan="2" style="text-align:left;">
<input type="hidden" name="start" value="Suchen">
<input type="submit" name="start" value="Verbindung suchen" tabindex="5" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; width:130px; vertical-align: middle; cursor:pointer; -moz-border-radius: 3px 3px 3px 3px; background-color:#EE0000; border:1px solid #B20000; color:#FFFFFF; font-weight:bold; height:auto; line-height:20px; padding:0px 10px; text-decoration:none; white-space:nowrap;">
</td>
</tr>
<tr>
<td colspan="2" style="text-align:left;">
<a style="font-family:Arial,Helvetica,sans-serif; font-size:12px; text-align:left; margin-top:4px; color: #6B7786; text-decoration:none; display:block;" href="http://www.sbb.ch/166" target="_blank" title="Aktuelle Informationen zu Streiks und grösseren Unterbrüchen im Schienenverkehr."><img src="http://fahrplan.sbb.ch/img/one/icon_arrow_right.png" alt="" style="vertical-align:top; padding-right:2px; border:none;" />Bahnverkehrsinformation</a>
</td>
</tr>
</table>
</form>
</div>
</div>
<script language="JavaScript1.2" type="text/javascript">
/* <![CDATA[ */
var time=new Date();
var hour = time.getHours(); hour=(hour<10)? '0'+hour:hour;
var minute = time.getMinutes();minute=(minute<10)? '0'+minute:minute;
var travelTime = hour+':'+minute;
document.formular.REQ0JourneyTime.value=travelTime;
// /* ]]> */
</script>
Source of the code: http://fahrplan.sbb.ch/bin/help.exe/en?application=INPUTGEN&tpl=inputgen_start
When I create a normal HTML-site the widget works without problems.
But in an asp-site there is a problem with the javascript.
In the line "document.formular.REQ0JourneyTime.value=travelTime;" there comes this error-message:
"JScript runtime error: The property "REQ0JourneyTime" can not be retrieved value: The object is null or undefined."
I think the problem has something to do with the form-tag of the widget ands the post-action, but I doent know, what exactly it is :S
Does somebody know how to fix that issue? Thank you very much!
Michael
You should probably be accessing the form by document.forms.formular or document.forms['formular'], not document.formular.
Also, on the end of the <input ... name="REQ0JourneyTime" ... /> you have > not />.
I think you have nested an HTML form inside your ASPX server-side form tag.
Form tag on ASP.net page
You could try using AJaX within your widget rather than posting back via traditions form.
Read this article too: http://msdn.microsoft.com/en-us/magazine/cc164151.aspx

Categories

Resources