Allingment issue in html - need to get the record in right corner - html

I have added a new row .
for defaultGPnamer i need to bring that to the right end.
Please help on this .
attached the code
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<div class="rounded" style="margin-left:10px">
<table style="width: 560px; height:95px;">
<tr>
<td colspan="3" style="height:22px">
<div>
<span style="font-size:11pt; color:#008FBE; font-weight:bold; line-height: 22px"><%#Eval("MMHMember")%><%#Eval("UserName") %></span>
<i><b><%#Eval("gender")%> <%#Eval("Age","{0} Yrs</b>") %></b></i>
<span><%#Eval("DateOfBirth")%>
</span>
</div>
</td>
<td style="text-align:right">
<span style="color:#008FBE; font-size:11pt; line-height: 22px;"><%#Eval("NHINumber")%></span>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbldefaultgp" runat="server" style="font-weight:bold;color:#008FBE;"><%#Eval("DefaultGPName")%></asp:Label>
</td>
</tr>
<tr style="text-align:left; vertical-align:top">
<td style="width:100px;">
<asp:Image ID="imgPatientPhoto" runat="server" ImageUrl='<%#GetPhotoURL(Eval("PhotoURL","{0}"))%>' style="width:90px;height:95px" />
</td>
<td style="width: 125px">
<br />
<asp:Label ID="lblHome" runat="server" style="font-weight:bold"><%#Eval("HomePhone")%></asp:Label>
<br />
<asp:Label ID="lblWork" runat="server" style="font-weight:bold"><%#Eval("WorkPhone")%></asp:Label>
<br />
<asp:Label ID="lblMobail" runat="server" style="font-weight:bold"><%#Eval("Mobilenumber")%></asp:Label>
</td>
<td style="width:140px;">
<asp:Label ID="lblAddress" runat="server" style="font-weight:bold"><%#Eval("Address") %></asp:Label>
</td>
<td style="" >
<asp:Label runat ="server" ID ="lblEnrolledPractice"><%#Eval("businessname") %> </asp:Label> <br />
<asp:Label runat ="server" ID ="lblCasualPractice"><%#Eval("CasualBusinessname") %> </asp:Label>
<p>
<asp:LinkButton ID="lnkViewConsentSetting" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="ConsentSetting" Visible="<%# ApplyCareSetting %>" >View Consent Settings</asp:LinkButton>
</p>
<p>
<asp:LinkButton ID="lnkViewHealthSummary" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="HealthSummary" Visible ='<%# SetHESVisible("SEHR") %>'>View Health Summary</asp:LinkButton>
<asp:LinkButton ID="lnkViewHealthSummaryConsent" runat="server" Visible ='<%# SetHESVisible("CONSENT") %>' Text="View Health Summary"></asp:LinkButton>
</p>
</td>
</tr>
</table>
</div>
</ItemTemplate>
I would be greatful if someone can help on this.
Label id is lbldefaultgp.
need to bring that data to right end in the banner.
notes::::

<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<div class="rounded" style="margin-left:10px">
<table style="width: 560px; height:95px;">
<tr>
<td colspan="3" style="height:22px">
<div>
<span style="font-size:11pt; color:#008FBE; font-weight:bold; line-height: 22px"><%#Eval("MMHMember")%><%#Eval("UserName") %></span>
<i><b><%#Eval("gender")%> <%#Eval("Age","{0} Yrs</b>") %></b></i>
<span><%#Eval("DateOfBirth")%>
</span>
</div>
</td>
<td style="text-align:right">
<span style="color:#008FBE; font-size:11pt; line-height: 22px;"><%#Eval("NHINumber")%></span>
</td>
</tr>
<tr>
<td colspan="3" style="height:22px">
<div>
</div>
</td>
<td>
<p>is this the thing you want?</p> <asp:Label ID="lbldefaultgp" runat="server" style="font-weight:bold;color:#008FBE;"><%#Eval("DefaultGPName")%></asp:Label>
</td>
</tr>
<tr style="text-align:left; vertical-align:top">
<td style="width:100px;">
<asp:Image ID="imgPatientPhoto" runat="server" ImageUrl='<%#GetPhotoURL(Eval("PhotoURL","{0}"))%>' style="width:90px;height:95px" />
</td>
<td style="width: 125px">
<br />
<asp:Label ID="lblHome" runat="server" style="font-weight:bold"><%#Eval("HomePhone")%></asp:Label>
<br />
<asp:Label ID="lblWork" runat="server" style="font-weight:bold"><%#Eval("WorkPhone")%></asp:Label>
<br />
<asp:Label ID="lblMobail" runat="server" style="font-weight:bold"><%#Eval("Mobilenumber")%></asp:Label>
</td>
<td style="width:140px;">
<asp:Label ID="lblAddress" runat="server" style="font-weight:bold"><%#Eval("Address") %></asp:Label>
</td>
<td style="" >
<asp:Label runat ="server" ID ="lblEnrolledPractice"><%#Eval("businessname") %> </asp:Label> <br />
<asp:Label runat ="server" ID ="lblCasualPractice"><%#Eval("CasualBusinessname") %> </asp:Label>
<p>
<asp:LinkButton ID="lnkViewConsentSetting" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="ConsentSetting" Visible="<%# ApplyCareSetting %>" >View Consent Settings</asp:LinkButton>
</p>
<p>
<asp:LinkButton ID="lnkViewHealthSummary" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="HealthSummary" Visible ='<%# SetHESVisible("SEHR") %>'>View Health Summary</asp:LinkButton>
<asp:LinkButton ID="lnkViewHealthSummaryConsent" runat="server" Visible ='<%# SetHESVisible("CONSENT") %>' Text="View Health Summary"></asp:LinkButton>
</p>
</td>
</tr>
</table>
</div>
</ItemTemplate>

Related

ASPX page not showing up in any browser

I am developing an aspx page, almost everything works fine if vb-design, but nothing showing up in IE, Firefox, Chrome...I can't open the page in any browser...so I can manage to see my project. But I can't run it, I don't know where to look or what to do.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 60%;
border-collapse: collapse;
border-style: solid;
border-width: 2px;
}
.auto-style2 {
text-decoration: underline;
}
.auto-style3 {
width: 1006px;
border-collapse: collapse;
}
.auto-style4 {
width: 194px;
}
.auto-style5 {
width: 194px;
height: 122px;
}
.auto-style6 {
height: 122px;
width: 600px;
}
.auto-style7 {
width: 600px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td><asp:Label runat="server" ID="lblLastName" Text="Last name"></asp:Label></td>
<td>
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblFirstName" runat="server" Text="First Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblOfferDate" runat="server" Text="Offer date"></asp:Label>
</td>
<td>
<asp:Calendar ID="calOfferDate" runat="server" BackColor="White" BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px" Width="200px">
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<NextPrevStyle VerticalAlign="Bottom" />
<OtherMonthDayStyle ForeColor="#808080" />
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<SelectorStyle BackColor="#CCCCCC" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<WeekendDayStyle BackColor="#FFFFCC" />
</asp:Calendar>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblOfferExpirationDate" runat="server" Text="Offer expiration date"></asp:Label>
</td>
<td>
<asp:Calendar ID="calOfferExpirationDate" runat="server" BackColor="White" BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px" Width="200px">
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<NextPrevStyle VerticalAlign="Bottom" />
<OtherMonthDayStyle ForeColor="#808080" />
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<SelectorStyle BackColor="#CCCCCC" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<WeekendDayStyle BackColor="#FFFFCC" />
</asp:Calendar>
</td>
</tr>
</table>
<hr />
<br />
<span class="auto-style2"><strong>Set up your car
<br />
</strong>
<table class="auto-style3">
<tr>
<td class="auto-style4">
<asp:Label ID="lblEquipmentLevel" runat="server" Text="Equipment level"></asp:Label>
</td>
<td class="auto-style7">
<asp:DropDownList ID="cbEquipmentLevel" runat="server">
<asp:ListItem Selected="True">Standard</asp:ListItem>
<asp:ListItem>Evolved</asp:ListItem>
<asp:ListItem>Advanced</asp:ListItem>
<asp:ListItem>Premium</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lblWarrantyType" runat="server" Text="Warranty type"></asp:Label>
</td>
<td class="auto-style7">
<asp:RadioButtonList ID="rblWarrantyList" runat="server">
<asp:ListItem Selected="True">Standard (2 years)</asp:ListItem>
<asp:ListItem>Extended (5 years)</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="auto-style5">
<asp:Label ID="lblOptionals" runat="server" Text="Optionals"></asp:Label>
</td>
<td class="auto-style6">
<asp:RadioButtonList ID="rblOptionals" runat="server" AutoPostBack="True">
<asp:ListItem Selected="True">Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:RadioButtonList>
<asp:CheckBoxList ID="cblOptionals" runat="server" RepeatDirection="Horizontal" Width="727px">
<asp:ListItem>Alloys wheels</asp:ListItem>
<asp:ListItem>Climatronic</asp:ListItem>
<asp:ListItem>Automatic pilot</asp:ListItem>
<asp:ListItem>Road alert</asp:ListItem>
<asp:ListItem>Navigation</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lblDiscounts" runat="server" Text="Discounts"></asp:Label>
</td>
<td class="auto-style7"><strong>
<asp:Label ID="lblWholepayment" runat="server" Text="Whole payment"></asp:Label>
</strong>
<asp:CheckBox ID="cbWhole" runat="server" />
<strong>
<asp:Label ID="lblCasco" runat="server" Text="CASCO Insurance"></asp:Label>
</strong>
<asp:CheckBox ID="cbCasco" runat="server" />
</td>
</tr>
<tr>
<td class="auto-style4"> </td>
<td class="auto-style7">
<asp:Button ID="btnDiplayOffer" runat="server" BackColor="Red" BorderColor="White" ForeColor="White" Text="Display Offer" />
</td>
</tr>
</table>
</span>
</div>
<asp:Label ID="LblMessage" runat="server" ></asp:Label>
</form>
</body>
</html>

Asp.net Repeater Table style to show check boxes in the rows

I tried few ways of implementing Asp.net Repeaterto show check boxes in the rows. But the html table is doesnt seem to work as expected. Could anyone please help?
<icw:Form runat="server" Caption="Action Options" ID="Form2">
<p>
Tick or un-tick roles to allow/disallow compact view</p>
<div style="width: 60%;">
<div>
<span class="headercell">Action Name</span>
<span class="headercell">Include on menu</span>
<span class="headercell">Include as button(max 3)</span>
<span class="headercell">Action button text</span>
</div>
<asp:Repeater runat="server" ID="actionSettingRepeater">
<ItemTemplate>
<div class="row">
<span class="cell">
<icw:Label ID="controlAction" runat="server" Text='<%# Eval("ControlAction")%>' />
</span><span class="cell">
<icw:CheckBox AutoPostback="true" OnValueChanged="SettingsChanged" runat="server"
ID="buttonEnabled" Checked='<%# Eval("ButtonEnabled")%>' />
</span><span class="cell">
<icw:CheckBox AutoPostback="true" OnValueChanged="SettingsChanged" runat="server"
ID="menuEnabled" Checked='<%# Eval("MenuEnabled")%>' />
</span><span>
<icw:Label ID="actionControlText" runat="server" Text='<%# Eval("Description")%>' />
</span>
<asp:HiddenField runat="server" ID="drugChartSettingId" Value='<%# Eval("DrugChartSettingID") %>' />
<div class="row">
</ItemTemplate>
</asp:Repeater>
</div>
</icw:Form>
and the style applied is below
.cell{background-color: Silver;width: 25%;display: block;float: left;border:none;text-align: left;}.headercell{width: 25%;display: block;float: left; border: none;text-align: left;} .row{clear: both;height: 5em;vertical-align: middle;}
I tried with simple html table as well.
<icw:Form runat="server" Caption="Action Options" ID="Form2">
<p>
Tick or un-tick roles to allow/disallow compact view</p>
<table>
<thead>
<tr>
<td>
Action Name
</td>
<td>
Include on menu
</td>
<td>
Include as button(max 3)
</td>
<td>
Action button text
</td>
</tr>
</thead>
<tbody>
<asp:Repeater runat="server" ID="actionSettingRepeater">
<ItemTemplate>
<tr>
<td>
<icw:Label ID="controlAction" runat="server" Text='<%# Eval("ControlAction")%>' />
</td>
<td>
<icw:CheckBox AutoPostback="true" OnValueChanged="SettingsChanged" runat="server"
ID="buttonEnabled" Checked='<%# Eval("ButtonEnabled")%>' />
</td>
<td colspan="1">
<icw:CheckBox AutoPostback="true" OnValueChanged="SettingsChanged" runat="server"
ID="menuEnabled" Checked='<%# Eval("MenuEnabled")%>' />
</td>
<td>
<icw:Label ID="actionControlText" runat="server" Text='<%# Eval("ControlText")%>' />
<%--<label><%# Eval("Description")%></label>--%>
</td>
<asp:HiddenField runat="server" ID="drugChartSettingId" Value='<%# Eval("DrugChartSettingID") %>' />
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</icw:Form>
still table alignment looks very bad as below. Could anyone please help?

Fix header row in repeater in ASP.NET

i am trying to figure out how to fix the header row with in the repeater using asp.net. When trying to put position:fixed; in the tr tag. It seems to fix it but it becomes smaller in size and doesn't work with the rest of the table.
any hints or help in the right direction would help significantly!
thanks
<div class="form-panel" style="font-size: small; text-align: left;">
<div class="header">
<div class="contentRestriction" style="height: 22px">
Action Bulletin Exception
<asp:button id="addException" text="Add Exception" runat="server" style="float: right; margin-right: 20px" onclick="addExceptions" />
</div>
</div>
<div class="commands">
<div class="contentRestriction" style="overflow-y: scroll; width: 100%; height: 185px">
<asp:repeater id="repException" runat="server" datasourceid="SP_AB_BULLETIN_EXCEPTION">
<HeaderTemplate>
<div class="form-panel" style="font-size: small;">
<table class="notepad-table" cellpadding="2" cellspacing="0" width="100%" >
<tr style="background-color: #eeeeee; font-weight: bold; ">
<td>Date Time From</td>
<td>Date Time To</td>
<td>Status</td>
<td>Last Modified</td>
<td>Last Modified By</td>
<td>Action</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr id="tr1" runat="server">
<td>
<asp:Literal ID="Literal1" runat="server" Text='<%# Eval("EFTV_FROM") %>' />
</td>
<td>
<asp:Literal ID="Literal2" runat="server" Text='<%# Eval("EFTV_TO") %>' />
</td>
<td>
<asp:Literal ID="Literal3" runat="server" Text='<%# Eval("AB_STATUS1") %>' />
</td>
<td>
<asp:Literal ID="Literal4" runat="server" Text='<%# Eval("LAST_MOD_DATE") %>' />
</td>
<td>
<asp:Literal ID="Literal6" runat="server" Text='<%# Eval("UserName") %>' />
</td>
<td>
<asp:Button ID="editException" Text="Edit" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="editException" />
<asp:Button ID="deleteException" Text="Delete" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="deleteException" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
</div>
To get the fixed header effect you can make two small changes to your code.
1) Paste the following style rules in the <head> section of your page:
<style type="text/css">
table tbody, table thead {
display: block;
}
table tbody {
overflow: auto;
height: 100px;
}
th, td {
width: 150px;
}
</style>
2) Replace your <div class="commands"> with the one below:
<div class="commands">
<asp:Repeater ID="repException" runat="server" DataSourceID="SP_AB_BULLETIN_EXCEPTION">
<HeaderTemplate>
<div class="form-panel" style="font-size: small;">
<table class="notepad-table" cellpadding="2" cellspacing="0">
<thead>
<tr style="background-color: #eeeeee; font-weight: bold;">
<th>Date Time From</th>
<th>Date Time To</th>
<th>Status</th>
<th>Last Modified</th>
<th>Last Modified By</th>
<th>Action</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr id="tr1" runat="server">
<td>
<asp:Literal ID="Literal1" runat="server" Text='<%# Eval("EFTV_FROM") %>' />
</td>
<td>
<asp:Literal ID="Literal2" runat="server" Text='<%# Eval("EFTV_TO") %>' />
</td>
<td>
<asp:Literal ID="Literal3" runat="server" Text='<%# Eval("AB_STATUS1") %>' />
</td>
<td>
<asp:Literal ID="Literal4" runat="server" Text='<%# Eval("LAST_MOD_DATE") %>' />
</td>
<td>
<asp:Literal ID="Literal6" runat="server" Text='<%# Eval("UserName") %>' />
</td>
<td>
<asp:Button ID="editException" Text="Edit" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="editException" />
<asp:Button ID="deleteException" Text="Delete" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="deleteException" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
Output:

Cannot display table in desired format

I have the following HTML:
<table cellspacing="10px" cellpadding="10px" width="100%" style="border-spacing: 10px">
<tr align="left">
<td>
<asp:Label ID="Label0" runat="server" Text="<%$ Resources:Strings, OrderReference %>" />
<asp:Label ID="TRANS_NB_LB" runat="server" />
<asp:Label ID="Label5" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Shipment %>" />
<asp:Label ID="SHIP_COST_LB" runat="server" />
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label1" runat="server" TabIndex="5" Text="<%$ Resources:Strings, OrderAmount %>" />
<asp:Label ID="TRANS_AMOUNT_LB" runat="server" />
<asp:Label ID="Label2" runat="server" TabIndex="5" Text="<%$ Resources:Strings, ShippingMethod %>" />
<asp:Label ID="SHIPP_METH_LB" runat="server" />
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label3" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Date %>" />
<asp:Label ID="TRANS_DATE_LB" runat="server" />
<%-- --%>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" TabIndex="5" Text="<%$ Resources:Strings, BillNumber %>" />
<asp:Label ID="SHIP_BILL_NUMBER_LB" runat="server" />
<%-- --%>
</td>
</tr>
</table>
It displays the following table:
I'd like to fix the columns so that they are properly displayed under each other such as: (Replace "_" by space)
Order Reference__OSP-00060000308__________Shipment_________100.00000.
Order Amount_____879.00000________________Shipping Method.
Date_____________7/13/2016 11:17:38 AM.
Bill Number______SHIP-000000000227.
How do I fix that? How can I add border spacing? Also is there a way I can add ":" after the element names (such as Order Reference: )?
Sorry I'm new at this, found my answer:
<table cellspacing="10px" cellpadding="10px" width="100%" style="border-spacing: 10px">
<tr align="left">
<td>
<asp:Label ID="Label0" runat="server" Text="<%$ Resources:Strings, OrderReference %>" />
</td>
<td>
<asp:Label ID="TRANS_NB_LB" runat="server" />
</td>
<td>
<asp:Label ID="Label5" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Shipment %>" />
</td>
<td>
<asp:Label ID="SHIP_COST_LB" runat="server" />
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label1" runat="server" TabIndex="5" Text="<%$ Resources:Strings, OrderAmount %>" />
</td>
<td>
<asp:Label ID="TRANS_AMOUNT_LB" runat="server" />
</td>
<td>
<asp:Label ID="Label2" runat="server" TabIndex="5" Text="<%$ Resources:Strings, ShippingMethod %>" />
</td>
<td>
<asp:Label ID="SHIPP_METH_LB" runat="server" />
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label3" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Date %>" />
</td>
<td>
<asp:Label ID="TRANS_DATE_LB" runat="server" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" TabIndex="5" Text="<%$ Resources:Strings, BillNumber %>" />
</td>
<td>
<asp:Label ID="SHIP_BILL_NUMBER_LB" runat="server" />
</td>
</tr>
</table>
Hope I didn't waste your time and that this may be useful for noobs like me :)

The whole page gets refresh while using Captcha refresh

I have used the captcha refresh button to refresh the captcha code, but the scenario is that when I click on the refresh image, the whole form gets refreshed. Please help. Also see the code below:-
<table style="width: 583px;">
<tr>
<td>Name</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" class="txtfld-popup"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter your Full Name" ControlToValidate="Fullname" Display="Dynamic" Style="font-size: 13px;"></asp:RequiredFieldValidator>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender4" runat="server" TargetControlID="FullName" WatermarkText="Enter Your Full Name"></cc1:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>Contact No.</td>
<td>
<asp:TextBox ID="TextBox2" class="txtfld-popup" runat="server" MaxLength="10" onkeypress="if(event.keyCode<48 || event.keyCode>57)event.returnValue=false;"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please enter Contact No." Display="Dynamic" ControlToValidate="ContactNo" ValidationExpression="\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*" Style="font-size: 13px;"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Please enter valid Contact No." Display="Dynamic" ControlToValidate="ContactNo" ValidationExpression="^\d{10}$" Style="font-size: 13px;"></asp:RegularExpressionValidator>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender5" runat="server" TargetControlID="ContactNo" WatermarkText="Enter Your Contact No."></cc1:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>Purpose </td>
<td>
<asp:TextBox ID="TextBox3" runat="server" class="txtfld-popup" ValidationGroup="VG"></asp:TextBox>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender6" runat="server" TargetControlID="Purpose" WatermarkText="Enter Your Purpose"></cc1:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td> </td>
<td>
<div>
<cc1:CaptchaControl ID="CaptchaControl1" runat="server" CaptchaBackgroundNoise="Low" CaptchaLength="5"
CaptchaHeight="60" CaptchaWidth="200" CaptchaMinTimeout="5" CaptchaMaxTimeout="240"
FontColor="#D20B0C" NoiseColor="#B1B1B1" Width="150" />
</div>
<asp:ImageButton ID="ImageButton2" ImageUrl="~/images/refresh.png" runat="server" CausesValidation="false" />
<br />
<asp:TextBox ID="TextBox4" runat="server" MaxLength="5"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator2" ErrorMessage="Invalid. Please try again." OnServerValidate="ValidateCaptcha"
runat="server" />
<p style="margin-top: 3px; margin-bottom: 3px;">
<asp:Label ID="Label1" runat="server"></asp:Label>
</p>
</td>
</tr>
<tr>
<td> </td>
<td>
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="btnSend_Click" class="button-form" Width="100" />
<asp:Button ID="Button2" runat="server" Text="Reset" OnClick="btnReset_Click" class="button-form" Width="100" CausesValidation="false" /></td>
</tr>
Also see the code behind for your reference:-
protected void ValidateCaptcha(object sender, ServerValidateEventArgs e)
{
Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim());
e.IsValid = Captcha1.UserValidated;
if (e.IsValid)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "ResponseDialog", "$(document).ready(function(){ResponseDialog();});", true);
SendMail();
}
}
Please help
Finally added a update panel for the solution:-
<tr>
<td> </td>
<td>
<div>
<asp:UpdatePanel ID="updatePanel" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<cc1:CaptchaControl ID="Captcha1" runat="server" CaptchaBackgroundNoise="Low" CaptchaLength="5"
CaptchaHeight="60" CaptchaWidth="200" CaptchaMinTimeout="5" CaptchaMaxTimeout="240"
FontColor="#D20B0C" NoiseColor="#B1B1B1" />
</td>
<td>
<asp:ImageButton ID="ImgRefreshButton" ImageUrl="~/images/refresh.png" runat="server" CausesValidation="false" />
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ImgRefreshButton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:TextBox ID="txtCaptcha" runat="server" MaxLength="5"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator1" ErrorMessage="Invalid. Please try again." OnServerValidate="ValidateCaptcha"
runat="server" />
<p style="margin-top: 3px; margin-bottom: 3px;">
<asp:Label ID="lblLeaveNo2" runat="server"></asp:Label>
</p>
</td>
</tr>
And it is working for me. :)