Validations not working - asp.net

I have few text boxes which has required field validation. In the same page there is a back button and next button. When i click in the back button the validations are working, when i click on the next button validations are not working (means the form is moving to the next page)
Please help me to rectify
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="RequestorForm.aspx.vb"
Inherits="WebApplication1.RequestorForm" %>
<!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">
<title>Requestor Form</title>
<link rel="stylesheet" type="text/css" href="homepage2005.css">
<script language="javascript" type="text/javascript">
//Call Server Event on User id onblur()
function CallClientEvent() {
__doPostBack("txt_view1_userID_TextChanged", "");
}
function CheckValidation() {
Page_ClientValidate();
if (Page_IsValid) {
if (CheckRoleValidation()) {
if ('<%=strRoleType%>' == 'chkBx_Store_wu') {
return CheckTeamViewerDep();
}
}
else {
return false;
}
}
}
function CheckTeamViewerDep() {
var ctl = document.getElementById('chkbx_teamLeadStockRoom');
if (ctl.disabled) {
return true;
}
var tDiv = document.getElementById('chkDepGroup');
var chkitm = tDiv.getElementsByTagName("input");
for (var i = 0; i < chkitm.length; i++) {
if (chkitm[i].checked) {
return true;
}
}
var ctlvalidate = document.getElementById('span_chkDepGroup');
ctlvalidate.innerHTML = 'Please select Dep';
return false;
}
function CheckRoleValidation() {
//var cblItm = '<%=gvRoleDep%>';
var tDiv = document.getElementById('gvRoleDep');
var chkitm = tDiv.getElementsByTagName("input");
var flag = false;
var chkItemCount = 0;
for (var i = 0; i < chkitm.length; i++) {
if (chkitm[i].checked) {
chkItemCount++;
flag = true;
}
}
var ctlvalidate = document.getElementById('lbl_chkBx_store_wu');
if (!flag) {
ctlvalidate.innerHTML = 'Please select Role(s)';
return false;
}
if (chkItemCount > 5) {
ctlvalidate.innerHTML = 'Maximum of 5 Role(s) only can be checked';
return false;
}
}
function ValidateDropDown() {
Page_ClientValidate();
flag = 1;
objTOR = document.getElementById('ddl_view0_typeOfRequest');
objWUL = document.getElementById('ddl_view0_wuLevel');
if (Page_IsValid) {
//alert(objTOR.selectedIndex);
TOR = document.getElementById('span_ddl_view0_typeOfRequest');
WUL = document.getElementById('span_ddl_view0_wuLevel');
if (objTOR.selectedIndex == 0) {
//alert('Select a value:');
TOR.innerHTML = "*Please select a Type of Request";
flag = 0;
}
else
TOR.innerHTML = " ";
// if (objWUL.selectedIndex == 0) {
// WUL.innerHTML = "*Please select a W A";
// flag = 0;
// }
// else
// WUL.innerHTML = " ";
if (flag == 0)
return false;
return true;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left: 10px">
<asp:MultiView runat="server" ID="mvRequestorForm" ActiveViewIndex="0">
<asp:View runat="server" ID="view_0">
<h1 class="blue">
<asp:Label ID="lbl_viewTitle0" runat="server" Text="Label"></asp:Label>
</h1>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="tabRow" width="150">
<asp:Label ID="lbl_view0_firstName" runat="server" Text="Firstname "></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_firstName" runat="server" AutoCompleteType="FirstName"
CssClass="text_box_3" TabIndex="1"></asp:TextBox>
<asp:Label ID="Label5" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="Validator_FirstName" runat="server"
ControlToValidate="txt_firstName" ErrorMessage="* Required field"
ValidationGroup="Form1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view0_surname" runat="server" Text="Surname"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSurName" runat="server" AutoCompleteType="LastName"
CssClass="text_box_3" TabIndex="3"></asp:TextBox>
<asp:Label ID="Label6" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="Validator_Surname" runat="server"
ControlToValidate="txtSurName" ErrorMessage="* Required field"
ValidationGroup="Form1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view0_ContactNum" runat="server" Text="Contact number"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_contactNum" runat="server"
AutoCompleteType="BusinessPhone" CssClass="text_box_3" TabIndex="3"></asp:TextBox>
<asp:Label ID="Label7" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="Validator_ContactNumber" runat="server"
ControlToValidate="txt_contactNum" ErrorMessage="* Required field"
ValidationGroup="Form1"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="txt_contactNum" ErrorMessage="Enter a numeric value"
MaximumValue="99999999999999" MinimumValue="0"></asp:RangeValidator>
</td>
</tr>
</table>
<hr class="blue" />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="tabRow" width="150">
<asp:Label ID="lbl_view0_typeOfRequest" runat="server" Text="Type of request"></asp:Label>
</td>
<td width="500">
<asp:DropDownList ID="ddl_view0_typeOfRequest" runat="server"
CssClass="drop_down_t" TabIndex="4">
<asp:ListItem Value="-1">Please select...</asp:ListItem>
<asp:ListItem>New</asp:ListItem>
<asp:ListItem>Update</asp:ListItem>
<asp:ListItem>Delete</asp:ListItem>
</asp:DropDownList>
<span ID="span_ddl_view0_typeOfRequest" class="errorText"></span>
</td>
<td>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view0_wuLevel" runat="server" Text="W A"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddl_view0_wuLevel" runat="server"
CssClass="drop_down_t" TabIndex="5">
<asp:ListItem Selected="True" Value="3">Store</asp:ListItem>
</asp:DropDownList>
<span ID="span_ddl_view0_wuLevel" class="errorText">
</span>
</td>
<td>
</td>
</tr>
<tr> <td> </td> <td></td><td> </td></tr>
</table>
<asp:Label ID="lblCaption1" runat="server"
Text="* Represents fields that needs to be filled mandatory"
Font-Size="XX-Small" ForeColor="#FF3300"></asp:Label>
<br />
<hr />
<asp:Button ID="btn_View0_Next" runat="server"
OnClientClick="return ValidateDropDown();" Text="Next"
ValidationGroup="Form1" />
<br />
</asp:View>
<asp:View runat="server" ID="view_1">
<asp:ScriptManager ID="scrMgr" runat="server">
</asp:ScriptManager>
<table>
<tr>
<td><asp:Label ID="lblException" CssClass="errorText" runat="server"></asp:Label></td>
</tr>
</table>
<h1 class="blue">
<asp:Label ID="lbl_viewTitle1" runat="server" Text="Label"></asp:Label>
</h1>
<table border="0">
<tr>
<td>
<table border="1" style="border-color:Green; border-width:thin;" width="100%">
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr id="trUserDetail" runat="server">
<td class="tabRow">
<asp:Label ID="lbl_view1_userID" runat="server"
Text="User ID "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_userID" runat="server" Text="" onblur="CallClientEvent()" AutoPostBack="true" >
</asp:TextBox>
<asp:Label ID="Label1" runat="server" ForeColor="Red" Text="*"></asp:Label>
<div class="smallText" nowrap> (This would be the ID you would normally log on with.)</div>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txt_view1_userID" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_panview3_label2" runat="server" Text="St Nu "></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_panview3_input2" runat="server" MaxLength="4">0000</asp:TextBox>
<asp:Label ID="Label8" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RangeValidator ID="RangeValidator2" runat="server"
ControlToValidate="txt_panview3_input2"
ErrorMessage="Please enter a valid 4-digit St Nu " MaximumValue="999999"
MinimumValue="1" Type="Integer" ValidationGroup="Form2"></asp:RangeValidator>
</td>
</tr>
<tr>
<td colspan="3">
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="txt_panview3_input2" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lblEmployeeNumber" runat="server"
Text="Employee Number "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtEmployeeNumber" runat="server">
</asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtEmployeeNumber" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_view1_firstName" runat="server" Text="Firstname "></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_view1_firstname" runat="server"></asp:TextBox>
<asp:Label ID="Label9" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_view1_firstname" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view1_surname" runat="server" Text="Surname "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_surname" runat="server"></asp:TextBox>
<asp:Label ID="Label10" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txt_view1_surname" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
<asp:Label ID="lblCaption2" runat="server"
Text="* Represents fields that needs to be filled mandatory"
Font-Size="XX-Small" ForeColor="Red"></asp:Label>
<hr />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<asp:Panel ID="panelHO" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" width="200">
<asp:Label ID="lbl_HO_wu" runat="server" CssClass="boldLabel"
Text="Role" />
</td>
<td align="left" width="200">
<asp:Label ID="lbl_panview1_label1" runat="server" CssClass="boldLabel"
Text="Dep" />
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td align="left" valign="top">
<asp:CheckBoxList ID="chkBx_HO_wu" runat="server" />
<span id="lbl_chkBx_HO_wu" class="errorText"></span>
</td>
<td align="left" valign="top">
<asp:DropDownList ID="ddl_panview1_ddinput1" runat="server">
<asp:ListItem>Avebury</asp:ListItem>
</asp:DropDownList>
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="panelRegion" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="30%">
<asp:Label ID="lbl_Region_wu" runat="server" CssClass="boldLabel"
Text="Role" />
</td>
<td width="30%">
<asp:Label ID="lbl_panview2_label1" runat="server" CssClass="boldLabel"
Text="Region" />
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td valign="top">
<asp:CheckBoxList ID="chkBx_Region_wu" runat="server" />
<span id="lbl_chkBx_Region_wu" class="errorText"></span>
</td>
<td valign="top">
<asp:DropDownList ID="ddl_panview2_ddinput1" runat="server">
<asp:ListItem>Northern (NORTHERN)</asp:ListItem>
<asp:ListItem>Central (CENTRAL)</asp:ListItem>
<asp:ListItem>Southern (SOUTHERN)</asp:ListItem>

Two possibilities spring immediately to mind:
The "next" button's CausesValidation property is set to false.
The "next" button is in a different ValidationGroup to the other controls.

Make sure the CausesValidation property is set to true on the buttons that you want validation to occur when clicked.
<asp:Button CausesValidation="TRUE" runat="server" />

Related

how to validating unique entries of textbox on repeater control?

I have a repeater control rptbrand in which one textbox txtMultiBrand is there and after each repeating time when i click btnAddBrand button i want validation for unique entries in textbox, here is my aspx code
<table width="100%">
<asp:Repeater ID="rptBrand" runat="server" OnItemDataBound="rptBrandDetail_ItemDataBound">
<ItemTemplate>
<tr>
<td align="right" `enter code here`width="150">
Brand<asp:Label ID="lblBrandNum" runat="server"></asp:Label>
<span class="msgred">*</span> :
</td>
<td align="left">
<table width="100%">
<tr>
<td align="left" width="20%">
<asp:TextBox ID="txtMultiBrand" CssClass="imageSearch" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ValidationGroup="VGrpMultiSave"
ControlToValidate="txtMultiBrand" ErrorMessage="Brand Required" Display="none"
SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ValidationGroup="VGrpSave"
ControlToValidate="txtMultiBrand" ErrorMessage="Brand Required" Display="none"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
<td align="left">
<asp:ImageButton ID="btnDelete" runat="server" CausesValidation="false" CommandName="CmdDelete"
CommandArgument='<%# Eval("SrNo") %>' ToolTip="Delete" ImageUrl="images/b_drop.png"
OnCommand="rptBrand_Command" Width="16" Height="16" OnClientClick="javascript:return confirm('Are you sure you want to remove brand?')" />
</td>
</tr>
</table>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
<td align="right" width="150">
</td>
<td>
<asp:Button ID="btnAddBrand" runat="server" Text="Add more" ValidationGroup="VGrpMultiSave"
OnClick="btnAddBrand_Click" />
<asp:ValidationSummary ID="ValidationSummary2" runat="server" DisplayMode="List"
ShowMessageBox="True" ShowSummary="False" ValidationGroup="VGrpMultiSave" />
</td>
</tr>
</table>
Using jQuery:
IT IS WORKING
Check the below link:
http://jsfiddle.net/NtF7h/
$(function () {
$("#<%=btnAddBrand.ClientID%>").on("click", function (event) {
var valueArray = new Array(); ;
$("input[id*='txtMultiBrand']").each(function (index) {
if ($.inArray($(this).val(), valueArray) == -1) {
valueArray[index] = $(this).val();
}
else {
alert("Duplicate Entry Found.");
event.preventDefault();
return false;
}
});
});
});

Calendar extender in modal popup extender ASP.NET not working

I'm using a calendar extender in a panel which popup using modalpopup extender, so panel is poped up contains the calendar extender but the calendar is behind every thing, i tried to change the z-index but all in vain, seems to me that it is a bug in the ASP.net AjaxToolKit.Any one has an idea about this problem and if it can be solved?
Edit:
<style type="text/css">
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=70);
opacity: 0.2;
}
.ob_show_panelsholder
{
border: 1px solid #736F6E;
}
.enterzipCalenderCompliant {
PADDING-RIGHT: 10px; FLOAT: left /*No display=inline*/
}
.ajax__calendar_container { z-index : 1000 ; }
</style>
<script type="text/javascript">
function calendarShown(sender, args) {
sender.style.zIndex = 10005;
}
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlShowPersonalData" runat="server">
<table class="style1">
<tr>
<td>
<asp:Image ID="_imgCurrentPP" runat="server" Height="100px" Width="100px" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="First name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblFirstName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLastName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="BirthDate :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblBirthDate" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblMobileNumber" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label12" runat="server" Text="Location :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLocation" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label13" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblGender" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnEditPersonalData" runat="server" Text="Edit Profile" />
<asp:ModalPopupExtender ID="_btnEditPersonalData_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="_btnEditPersonalData" BackgroundCssClass="modalBackground"
PopupControlID="_pnlEditPersonalData" CancelControlID="_btnCancel">
</asp:ModalPopupExtender>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="_pnlEditPersonalData" runat="server">
<table>
<tr>
<td>
<asp:Label ID="_FirstName" runat="server" Text="First name :" ></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtFirstName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_LastName" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtLastName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_BirthDate" runat="server" Text="Birth date :"></asp:Label>
</td>
<td class="ajax__calendar_container">
<asp:TextBox ID="_txtBirthDate" runat="server"></asp:TextBox>
<asp:MaskedEditExtender ID="_txtBirthDate_MaskedEditExtender" runat="server" Enabled="True"
TargetControlID="_txtBirthDate" MaskType="Date" ErrorTooltipEnabled="True" MessageValidatorTip="true"
Mask="99/99/9999">
</asp:MaskedEditExtender>
<div>
<asp:CalendarExtender ID="_txtBirthDate_CalendarExtender" runat="server" Enabled="True"
PopupButtonID="_btnCalendar" TargetControlID="_txtBirthDate">
</asp:CalendarExtender>
</div>
<asp:ImageButton ID="_btnCalendar" runat="server" ImageUrl="~/Images/calendar_button_b.jpg" />
<%-- <img alt="Icon" src="~/Images/calendar_button_b.jpg" id="Image1" />--%>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_ProfilePic" runat="server" Text="Profile picture :"></asp:Label>
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
<%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="FileUpload1"--%><%-- ErrorMessage="*" ValidationGroup="signup"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.png|.jpg)$"
ControlToValidate="FileUpload1" ErrorMessage="Please Select Png or Jpg File"
ValidationGroup="UploadFile"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_MobileNumber" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtMobileNumber" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Password" runat="server" Text="Password :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtPassword" runat="server"></asp:TextBox>
</td>
</tr>
</table>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlLocation" runat="server">
<table width="21%">
<tr>
<td>
<asp:Label ID="_Country" runat="server" Text="Country :"></asp:Label>
</td>
<td>
<uc1:CountryListUC ID="CountryListUC1" runat="server" EnablePostBack="True" EnableValidation="False"
OnListIndexChanged="CountrySelectedIndexChanged" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Governet" runat="server" Text="Governet:"></asp:Label>
</td>
<td>
<uc2:GovernateListUC ID="GovernateListUC1" runat="server" OnListIndexChanged="GovernateSelectedIndexChanged"
Enabled="False" EnablePostBack="True" EnableValidation="False" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="_District" runat="server" Text="District :"></asp:Label>
</td>
<td>
<uc3:DistrictListUC ID="DistrictListUC1" runat="server" Enabled="False" EnablePostBack="True"
EnableValidation="False" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="CountryListUC1" EventName="ListIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<table width="22%">
<tr>
<td>
<asp:Label ID="_Gender" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:DropDownList ID="_ddlGender" runat="server">
<asp:ListItem Value="1">Male</asp:ListItem>
<asp:ListItem Value="2">Female</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnSaveChanges" runat="server" OnClick="_btnSaveChages_Click" Text="Save changes"
ValidationGroup="signup" />
</td>
<td valign="bottom">
<asp:Button ID="_btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
is the calendar extender an ajax extender or did you mean the asp calendar control? Either way I've tried both in your same situation described and it works. Try posting some code you are using so we can see where the issue lies and be of further assistance.
Edit: here's the code I used from yours. I took out the usercontrols so I could debug the page and it seemed to work. Here's an a screenshot
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="web.test" %>
<!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>
<style type="text/css">
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=70);
opacity: 0.2;
}
.ob_show_panelsholder
{
border: 1px solid #736F6E;
}
.enterzipCalenderCompliant {
PADDING-RIGHT: 10px; FLOAT: left /*No display=inline*/
}
.ajax__calendar_container { z-index : 1000 ; }
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="smtest" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlShowPersonalData" runat="server">
<table class="style1">
<tr>
<td>
<asp:Image ID="_imgCurrentPP" runat="server" Height="100px" Width="100px" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="First name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblFirstName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLastName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="BirthDate :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblBirthDate" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblMobileNumber" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label12" runat="server" Text="Location :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblLocation" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label13" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:Label ID="_lblGender" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnEditPersonalData" runat="server" Text="Edit Profile" />
<ajaxToolkit:ModalPopupExtender ID="_btnEditPersonalData_ModalPopupExtender" runat="server" TargetControlID="_btnEditPersonalData" BackgroundCssClass="modalBackground" PopupControlID="_pnlEditPersonalData" CancelControlID="_btnCancel" />
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="_pnlEditPersonalData" runat="server">
<table>
<tr>
<td>
<asp:Label ID="_FirstName" runat="server" Text="First name :" ></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtFirstName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_LastName" runat="server" Text="Last name :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtLastName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_BirthDate" runat="server" Text="Birth date :"></asp:Label>
</td>
<td class="ajax__calendar_container">
<asp:TextBox ID="_txtBirthDate" runat="server"></asp:TextBox>
<ajaxtoolkit:MaskedEditExtender ID="_txtBirthDate_MaskedEditExtender" runat="server" Enabled="True"
TargetControlID="_txtBirthDate" MaskType="Date" ErrorTooltipEnabled="True" MessageValidatorTip="true"
Mask="99/99/9999">
</ajaxtoolkit:MaskedEditExtender>
<div>
<ajaxtoolkit:CalendarExtender ID="_txtBirthDate_CalendarExtender" runat="server" Enabled="True"
PopupButtonID="_btnCalendar" TargetControlID="_txtBirthDate">
</ajaxtoolkit:CalendarExtender>
</div>
<asp:ImageButton ID="_btnCalendar" runat="server" ImageUrl="~/Images/calendar_button_b.jpg" />
<%-- <img alt="Icon" src="~/Images/calendar_button_b.jpg" id="Image1" />--%>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_ProfilePic" runat="server" Text="Profile picture :"></asp:Label>
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
<%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="FileUpload1"--%><%-- ErrorMessage="*" ValidationGroup="signup"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.png|.jpg)$"
ControlToValidate="FileUpload1" ErrorMessage="Please Select Png or Jpg File"
ValidationGroup="UploadFile"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_MobileNumber" runat="server" Text="Mobile number :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtMobileNumber" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Password" runat="server" Text="Password :"></asp:Label>
</td>
<td>
<asp:TextBox ID="_txtPassword" runat="server"></asp:TextBox>
</td>
</tr>
</table>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="_pnlLocation" runat="server">
<table width="21%">
<tr>
<td>
<asp:Label ID="_Country" runat="server" Text="Country :"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_Governet" runat="server" Text="Governet:"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="_District" runat="server" Text="District :"></asp:Label>
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
<table width="22%">
<tr>
<td>
<asp:Label ID="_Gender" runat="server" Text="Gender :"></asp:Label>
</td>
<td>
<asp:DropDownList ID="_ddlGender" runat="server">
<asp:ListItem Value="1">Male</asp:ListItem>
<asp:ListItem Value="2">Female</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="_btnSaveChanges" runat="server" Text="Save changes"
ValidationGroup="signup" />
</td>
<td valign="bottom">
<asp:Button ID="_btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
CSS solution that worked for me:
.ajax__calendar_container
{
position :absolute;
z-index : 100003 !important;
}
Make sure to use !important declaration. Without it z-index was always overwrited by higher settings. You should also check z-index in css for popup dialog and it's background.

asp.net listview and findcontrol

I have listview and i need to bind the dropdown list in the list view to ListItemCollection which will be built using a function BindPages().
When I clicked on the AddNew Link I am not able to bind the dropdown.
<asp:ListView DataKeyNames="Menuid" OnItemCommand="lvParentMenus_ItemCommand" OnSorting="lvParentMenus_Sorting"
OnDataBound="lvParentMenus_DataBound" DataSourceID="SqlDataSource1" ID="lvParentMenus"
runat="server">
<LayoutTemplate>
<table border="0" id="listview" width="100%" class="grid" cellpadding="0" cellspacing="0">
<thead>
<tr class="listingheader ">
<td width="10%" style="text-align: center; !important">
<input type="checkbox" name="checkbox" id="headercheck" />
</td>
<td id="thsno" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Sort" CommandArgument="Sno"
Text="Sno" />
</td>
<td id="thmenutext" runat="server">
<asp:LinkButton runat="server" ID="LinkButton2" Text="Menu Text" CommandName="Sort"
CommandArgument="MenuText" />
</td>
<td id="thmenuurl" runat="server">
<asp:LinkButton runat="server" ID="LinkButton3" Text="Menu Url" CommandName="Sort"
CommandArgument="MenuUrl" />
</td>
<td id="thlevel" runat="server">
<asp:LinkButton runat="server" ID="LinkButton4" Text="Level of Display" CommandName="Sort"
CommandArgument="level" />
</td>
<td>
Action
</td>
</tr>
</thead>
<tbody>
<tr runat="server" id="itemPlaceholder">
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3" align="center">
<asp:Label ID="lblMessage" Text="dfdfdfd" runat="server"></asp:Label>
</td>
<td align="right">
<asp:LinkButton Text="Add New" ID="lnkNew" CommandName="FillDropDown" runat="server"
Font-Bold="true" OnClick="AddNew"></asp:LinkButton>
</td>
</tr>
</tfoot>
</table>
<ItemTemplate>
<tr class='<%# Container.DataItemIndex % 2 == 0 ? "lrow1" : "lrow1 altrow" %>'>
<td class="col1" align="center">
<asp:CheckBox runat="server" ID="chkitem"></asp:CheckBox>
</td>
<td class="lrow1">
<%# Eval("Sno")%>
<asp:HiddenField ID="hdnStoreID" runat="server" Value='<%# Eval("MenuId") %>' />
</td>
<td>
<%# Eval("MenuText")%>
</td>
<td>
<asp:DropDownList ID="ddlPagesList" runat="server" DataSource='<%#BindPages()%>'>
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlLevel" runat="server" DataSource='<%#BindLevel(6)%>' SelectedValue='<%# Eval("level")%>'>
</asp:DropDownList>
</td>
<td nowrap="nowrap">
<asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
|
<asp:LinkButton ID="lnkdelete" runat="server" CommandName="Delete" OnClientClick="javascript:return confirm('Are you sure to delete the current item');">Delete</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<InsertItemTemplate>
<tr class="lrow1">
<td class="col1" align="center">
</td>
<td class="lrow1">
</td>
<td class="lrow1">
<asp:TextBox ID="txtMenuText" runat="server" Width="80px" Text='<%# Eval("MenuText")%>'
CssClass="inputbox" ValidationGroup="InsertFields" />
<asp:RequiredFieldValidator ID="reqValidCity" ControlToValidate="txtMenuText" runat="server"
ErrorMessage="City Name is required." Display="Dynamic" ValidationGroup="InsertFields">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regValidCity" runat="server" ErrorMessage="Please Enter Alphabets only."
Display="Dynamic" ValidationGroup="g1" ControlToValidate="txtMenuText" ValidationExpression="^[a-zA-Z0-9\s]{2,1000}"></asp:RegularExpressionValidator>
</td>
<td>
<asp:DropDownList ID="ddlPagesList" runat="server" DataSource='<%#BindPages()%>'>
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlLevel" runat="server" DataSourceID="sdsLevel" DataValueField="level"
DataTextField="level">
</asp:DropDownList>
</td>
<td nowrap="nowrap">
<asp:LinkButton ID="lnkinsert" runat="server" OnClick="lnkinsert_Click" ValidationGroup="InsertFields"> Insert</asp:LinkButton>
</td>
</tr>
</InsertItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="usp_getParentMenus"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="ddlRoles" Name="intRoleid" PropertyName="Text" DefaultValue="1"
ConvertEmptyStringToNull="true" Direction="Input" />
</SelectParameters>
</asp:SqlDataSource>
and here is the method BindPAges()
protected ListItemCollection BindPages()
{
string sDir = Request.PhysicalApplicationPath;
if (FirstCount == 0)
DirSearch(sDir);
return collection;
}
When I tried to find the ddlPageList in the AddNew() method it is throwing error "Object referenc not set "
AddNEw() Method:
` protected void AddNew(object sender, EventArgs e)
{
lvParentMenus.InsertItemPosition = InsertItemPosition.FirstItem;
lvParentMenus.FindControl("lnkNew").Visible = false;
lvParentMenus.EditIndex = -1;
sdsLevel.ConnectionString = DBConnectionString.ConnectionString;
Parameter a = new Parameter("intRoleid", DbType.Int32);
a.DefaultValue = ddlRoles.SelectedValue.ToString();
sdsLevel.SelectParameters.Add(a);
sdsLevel.SelectCommand = "usp_getParentMenus";
DropDownList ddlpages = (DropDownList)lvParentMenus.FindControl("ddlPagesList");
string sDir = Request.PhysicalApplicationPath;
DirSearch(sDir);
ddlpages.DataSource = collection;
ddlpages.DataBind();
}
Need urgently.
Thanks.
Please try
DropDownList ddlpages = (DropDownList)lvParentMenus.Items[0].FindControl("ddlPagesList");
Have you tried to use runat=server property in TABLE in Listview?

Validation button problem

I have few text boxes which has required field validation. In the same page there is a back button and next button. When i click in the back button the validations are working, when i click on the next button validations are not working (means the form is moving to the next page)
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="RequestorForm.aspx.vb"
Inherits="WebApplication1.RequestorForm" %>
<!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">
<title>Requestor Form</title>
<link rel="stylesheet" type="text/css" href="homepage2005.css">
<script language="javascript" type="text/javascript">
//Call Server Event on User id onblur()
function CallClientEvent() {
__doPostBack("txt_view1_userID_TextChanged", "");
}
function CheckValidation() {
Page_ClientValidate();
if (Page_IsValid) {
if (CheckRoleValidation()) {
if ('<%=strRoleType%>' == 'chkBx_Store_wu') {
return CheckTeamViewerDep();
}
}
else {
return false;
}
}
}
function CheckTeamViewerDep() {
var ctl = document.getElementById('chkbx_teamLeadStockRoom');
if (ctl.disabled) {
return true;
}
var tDiv = document.getElementById('chkDepGroup');
var chkitm = tDiv.getElementsByTagName("input");
for (var i = 0; i < chkitm.length; i++) {
if (chkitm[i].checked) {
return true;
}
}
var ctlvalidate = document.getElementById('span_chkDepGroup');
ctlvalidate.innerHTML = 'Please select Dep';
return false;
}
function CheckRoleValidation() {
//var cblItm = '<%=gvRoleDep%>';
var tDiv = document.getElementById('gvRoleDep');
var chkitm = tDiv.getElementsByTagName("input");
var flag = false;
var chkItemCount = 0;
for (var i = 0; i < chkitm.length; i++) {
if (chkitm[i].checked) {
chkItemCount++;
flag = true;
}
}
var ctlvalidate = document.getElementById('lbl_chkBx_store_wu');
if (!flag) {
ctlvalidate.innerHTML = 'Please select Role(s)';
return false;
}
if (chkItemCount > 5) {
ctlvalidate.innerHTML = 'Maximum of 5 Role(s) only can be checked';
return false;
}
}
function ValidateDropDown() {
Page_ClientValidate();
flag = 1;
objTOR = document.getElementById('ddl_view0_typeOfRequest');
objWUL = document.getElementById('ddl_view0_wuLevel');
if (Page_IsValid) {
//alert(objTOR.selectedIndex);
TOR = document.getElementById('span_ddl_view0_typeOfRequest');
WUL = document.getElementById('span_ddl_view0_wuLevel');
if (objTOR.selectedIndex == 0) {
//alert('Select a value:');
TOR.innerHTML = "*Please select a Type of Request";
flag = 0;
}
else
TOR.innerHTML = " ";
// if (objWUL.selectedIndex == 0) {
// WUL.innerHTML = "*Please select a W A";
// flag = 0;
// }
// else
// WUL.innerHTML = " ";
if (flag == 0)
return false;
return true;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left: 10px">
<asp:MultiView runat="server" ID="mvRequestorForm" ActiveViewIndex="0">
<asp:View runat="server" ID="view_0">
<h1 class="blue">
<asp:Label ID="lbl_viewTitle0" runat="server" Text="Label"></asp:Label>
</h1>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="tabRow" width="150">
<asp:Label ID="lbl_view0_firstName" runat="server" Text="Firstname "></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_firstName" runat="server" AutoCompleteType="FirstName"
CssClass="text_box_3" TabIndex="1"></asp:TextBox>
<asp:Label ID="Label5" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="Validator_FirstName" runat="server"
ControlToValidate="txt_firstName" ErrorMessage="* Required field"
ValidationGroup="Form1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view0_surname" runat="server" Text="Surname"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSurName" runat="server" AutoCompleteType="LastName"
CssClass="text_box_3" TabIndex="3"></asp:TextBox>
<asp:Label ID="Label6" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="Validator_Surname" runat="server"
ControlToValidate="txtSurName" ErrorMessage="* Required field"
ValidationGroup="Form1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view0_ContactNum" runat="server" Text="Contact number"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_contactNum" runat="server"
AutoCompleteType="BusinessPhone" CssClass="text_box_3" TabIndex="3"></asp:TextBox>
<asp:Label ID="Label7" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="Validator_ContactNumber" runat="server"
ControlToValidate="txt_contactNum" ErrorMessage="* Required field"
ValidationGroup="Form1"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="txt_contactNum" ErrorMessage="Enter a numeric value"
MaximumValue="99999999999999" MinimumValue="0"></asp:RangeValidator>
</td>
</tr>
</table>
<hr class="blue" />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="tabRow" width="150">
<asp:Label ID="lbl_view0_typeOfRequest" runat="server" Text="Type of request"></asp:Label>
</td>
<td width="500">
<asp:DropDownList ID="ddl_view0_typeOfRequest" runat="server"
CssClass="drop_down_t" TabIndex="4">
<asp:ListItem Value="-1">Please select...</asp:ListItem>
<asp:ListItem>New</asp:ListItem>
<asp:ListItem>Update</asp:ListItem>
<asp:ListItem>Delete</asp:ListItem>
</asp:DropDownList>
<span ID="span_ddl_view0_typeOfRequest" class="errorText"></span>
</td>
<td>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view0_wuLevel" runat="server" Text="W A"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddl_view0_wuLevel" runat="server"
CssClass="drop_down_t" TabIndex="5">
<asp:ListItem Selected="True" Value="3">Store</asp:ListItem>
</asp:DropDownList>
<span ID="span_ddl_view0_wuLevel" class="errorText">
</span>
</td>
<td>
</td>
</tr>
<tr> <td> </td> <td></td><td> </td></tr>
</table>
<asp:Label ID="lblCaption1" runat="server"
Text="* Represents fields that needs to be filled mandatory"
Font-Size="XX-Small" ForeColor="#FF3300"></asp:Label>
<br />
<hr />
<asp:Button ID="btn_View0_Next" runat="server"
OnClientClick="return ValidateDropDown();" Text="Next"
ValidationGroup="Form1" />
<br />
</asp:View>
<asp:View runat="server" ID="view_1">
<asp:ScriptManager ID="scrMgr" runat="server">
</asp:ScriptManager>
<table>
<tr>
<td><asp:Label ID="lblException" CssClass="errorText" runat="server"></asp:Label></td>
</tr>
</table>
<h1 class="blue">
<asp:Label ID="lbl_viewTitle1" runat="server" Text="Label"></asp:Label>
</h1>
<table border="0">
<tr>
<td>
<table border="1" style="border-color:Green; border-width:thin;" width="100%">
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr id="trUserDetail" runat="server">
<td class="tabRow">
<asp:Label ID="lbl_view1_userID" runat="server"
Text="User ID "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_userID" runat="server" Text="" onblur="CallClientEvent()" AutoPostBack="true" >
</asp:TextBox>
<asp:Label ID="Label1" runat="server" ForeColor="Red" Text="*"></asp:Label>
<div class="smallText" nowrap> (This would be the ID you would normally log on with.)</div>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="txt_view1_userID" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_panview3_label2" runat="server" Text="St Nu "></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_panview3_input2" runat="server" MaxLength="4">0000</asp:TextBox>
<asp:Label ID="Label8" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RangeValidator ID="RangeValidator2" runat="server"
ControlToValidate="txt_panview3_input2"
ErrorMessage="Please enter a valid 4-digit St Nu " MaximumValue="999999"
MinimumValue="1" Type="Integer" ValidationGroup="Form2"></asp:RangeValidator>
</td>
</tr>
<tr>
<td colspan="3">
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="txt_panview3_input2" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lblEmployeeNumber" runat="server"
Text="Employee Number "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtEmployeeNumber" runat="server">
</asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtEmployeeNumber" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_view1_firstName" runat="server" Text="Firstname "></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_view1_firstname" runat="server"></asp:TextBox>
<asp:Label ID="Label9" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_view1_firstname" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view1_surname" runat="server" Text="Surname "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_surname" runat="server"></asp:TextBox>
<asp:Label ID="Label10" runat="server" ForeColor="Red" Text="*"></asp:Label>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txt_view1_surname" ErrorMessage="* Required field"
ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
<asp:Label ID="lblCaption2" runat="server"
Text="* Represents fields that needs to be filled mandatory"
Font-Size="XX-Small" ForeColor="Red"></asp:Label>
<hr />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<asp:Panel ID="panelHO" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" width="200">
<asp:Label ID="lbl_HO_wu" runat="server" CssClass="boldLabel"
Text="Role" />
</td>
<td align="left" width="200">
<asp:Label ID="lbl_panview1_label1" runat="server" CssClass="boldLabel"
Text="Dep" />
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td align="left" valign="top">
<asp:CheckBoxList ID="chkBx_HO_wu" runat="server" />
<span id="lbl_chkBx_HO_wu" class="errorText"></span>
</td>
<td align="left" valign="top">
<asp:DropDownList ID="ddl_panview1_ddinput1" runat="server">
<asp:ListItem>Avebury</asp:ListItem>
</asp:DropDownList>
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="panelRegion" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="30%">
<asp:Label ID="lbl_Region_wu" runat="server" CssClass="boldLabel"
Text="Role" />
</td>
<td width="30%">
<asp:Label ID="lbl_panview2_label1" runat="server" CssClass="boldLabel"
Text="Region" />
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td valign="top">
<asp:CheckBoxList ID="chkBx_Region_wu" runat="server" />
<span id="lbl_chkBx_Region_wu" class="errorText"></span>
</td>
<td valign="top">
<asp:DropDownList ID="ddl_panview2_ddinput1" runat="server">
<asp:ListItem>Northern (NORTHERN)</asp:ListItem>
<asp:ListItem>Central (CENTRAL)</asp:ListItem>
<asp:ListItem>Southern (SOUTHERN)</asp:ListItem>
Check whether the call to the ValidateDropDown method is in the generated HTML. Use Firebug to debug the JavaScript.

I want to reduce the spacing in my asp.net webform

i want to reduce the spacing inside my web page:
The problem is the buttons below "back" and "next" is not visible without scrolling down
I have posted the code below:
<asp:View runat="server" ID="view_1">
<asp:ScriptManager ID="scrMgr" runat="server">
</asp:ScriptManager>
<h1 class="blue" style="margin-bottom:0px;">
<asp:Label ID="lbl_viewTitle1" runat="server" Text="Label"></asp:Label>
</h1>
<div style="margin:0px; padding:0px; border:none; clear:both;">
<table border="0">
<tr>
<td>
<table border="1" style="border-color: Green; border-width: thin;">
<tr>
<td valign="top" id="tdReadableContent" runat="server">
<div style="height: 167px; width:450px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="blue" style="height:16px!important;" colspan="3"><b>Your Current Settings</b></td>
</tr>
<tr style="width:10px"><td colspan="3"></td></tr>
<tr id="trUserDetail_read" runat="server">
<td class="tabRow" valign="baseline">
<asp:Label ID="lbl_view1_userID_Read" runat="server" Text="User ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_userID_Read" ReadOnly="true" runat="server" AutoPostBack="true"
CssClass="text_box_gray"></asp:TextBox><div class="smallText" nowrap>
<%--(This would be the ID you would normally log on with.)--%></div>
</td>
<td> </td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_panview3_label2_read" runat="server" Text="Store Number "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_panview3_input2_read" CssClass="text_box_gray" ReadOnly="true" runat="server" MaxLength="4"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view1_surname_read" runat="server" Text="Surname"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_surname_read" ReadOnly="true" CssClass="text_box_gray" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr id="trFirstName_Read" runat="server">
<td width="150" class="tabRow">
<asp:Label ID="lbl_view1_firstName_Read" runat="server" Text="First Name"></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_view1_firstname_Read" ReadOnly="true" runat="server" CssClass="text_box_gray"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td></td>
<td>
<%--<asp:Label ID="Label1" CssClass="errorText" runat="server"></asp:Label>--%>
</td>
</tr>
<tr>
<td class="tabRow">
<%--<asp:Label ID="Label2" runat="server" Text="Employee Number "></asp:Label>--%>
</td>
<td width="200">
<%--<asp:TextBox ID="TextBox1" runat="server"
CssClass="text_box_3" MaxLength="10"></asp:TextBox>--%>
</td>
</tr>
</table>
</div>
<asp:Label runat="server" ID="label11"></asp:Label>
<hr class="hrRequestorForm" />
<div id="divRoleDepartment_ReadOnly" runat="server" style="margin-left:20px; height:390px; overflow:auto;" class="tabel1Parent">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<asp:Panel ID="panelStore_Read" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
<asp:GridView ID="gvRoleDepartment_ReadOnly" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkRole_Read" runat="server" Enabled="false" />
<input type="hidden" id="hdRoleCode_Read" value="<%#Bind('ddl_code') %>" runat="server" />
<input type="hidden" id='hdDepCode_Read' value="<%#Bind('dep_code') %>" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ddl_item" HeaderText="Role" ItemStyle-CssClass="roleColumn2" />
<asp:BoundField DataField="dep_name" HeaderText="Department" ItemStyle-CssClass="departmentColumn" />
</Columns>
<EmptyDataTemplate>
<div class="tabel1Parent">
<table border='0' cellpadding='0' cellspacing='0' style='border-color: green; border-width: thin;
width: 390px; border-left: #9787b1 solid 1px; border-top: #9787b1 solid 1px;'>
<tr>
<td class='roleColumn'>
<b>Role</b>
</td>
<td class='departmentColumn'>
<b>Department</b>
</td>
</tr>
</table>
</div>
</EmptyDataTemplate>
</asp:GridView>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</div>
</td>
<td valign="top" >
<div style="height:160px; width:450px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="blue" style="height:16px!important;" colspan="3"><b>
<asp:Label ID="lblNewSettings" runat='server' Text="Your New Settings"></asp:Label>
</b></td>
</tr>
<tr id="trUserDetail" runat="server">
<td class="tabRow" valign="baseline">
<asp:Label ID="lbl_view1_userID" runat="server" Text="User ID "></asp:Label>
</td>
<td class="textFieldColumn">
<asp:TextBox ID="txtUserID" TabIndex="1" text="Enter User id.."
runat="server" AutoPostBack="true"
CssClass="text_box_highlight"
onfocus="defaultStyle();"
onkeypress="ChangeUserIdBackground();"
MaxLength ="50"></asp:TextBox><span id="starUserId" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvUserID" runat="server" ControlToValidate="txtUserID"
ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator><div class="smallText" nowrap>
(This would be the ID you would normally log on with.)</div></td>
</tr>
<tr>
<td colspan="2" style="padding-left:135px">
<asp:Label ID="lblUserExists" CssClass="errorText" runat="server"></asp:Label>
<asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server"
ControlToValidate="txt_panview3_input2" ErrorMessage="Store should be a number"
ValidationExpression="[0-9]+"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_panview3_label2" runat="server" Text="Store Number "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_panview3_input2" runat="server"
MaxLength="4" CssClass="text_box_3">0000</asp:TextBox>
<span id="starStoreNumber" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvStoreNumber" runat="server"
ControlToValidate="txt_panview3_input2" ErrorMessage=" Required field"
ValidationGroup="Form2" ></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view1_surname" runat="server" Text="Surname "></asp:Label>
</td>
<td >
<asp:TextBox ID="txt_view1_surname" runat="server"
CssClass="text_box_3"
MaxLength ="50"></asp:TextBox>
<span id="starSurName" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvSurName" runat="server" ControlToValidate="txt_view1_surname"
ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr id="trFirstName" runat="server">
<td width="150" class="tabRow">
<asp:Label ID="lbl_view1_firstName" runat="server" Text="First Name"></asp:Label>
</td>
<td >
<asp:TextBox ID="txt_view1_firstname" runat="server"
CssClass="text_box_3"
MaxLength ="50"></asp:TextBox>
<span id="starFirstName" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ControlToValidate="txt_view1_firstname"
ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lblEmployeeNumber" runat="server" Text="Employee Number "></asp:Label>
</td>
<td width="280">
<asp:TextBox ID="txtEmployeeNumber" runat="server"
CssClass="text_box_3" MaxLength="6"></asp:TextBox>
<span id="starEmployeeNumber" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvEmplyeeNumber" runat="server" ControlToValidate="txtEmployeeNumber"
ErrorMessage="Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
<td>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server"
ControlToValidate="txtEmployeeNumber" ErrorMessage="Enter a numeric value"
ValidationExpression="[0-9]+"></asp:RegularExpressionValidator>
</td>
</tr>
</table>
<b><asp:Label ID="lblCaption2" runat="server" Text="Note: All fields are mandatory" ForeColor="Red"></asp:Label></b>
</div>
<hr class="hrRequestorForm" />
<div style="padding-left:20px;" id="divRoleDepartment" runat="server">
<div class="tabel1Parent">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Panel ID="panelStore" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
<asp:GridView ID="gvRoleDepartment" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkRole" runat="server" />
<input id="hdRoleCode" runat="server" type="hidden"
value="<%#Bind('ddl_code') %>" />
<input id="hdDepCode" runat="server" type="hidden"
value="<%#Bind('dep_code') %>" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ControlStyle-CssClass="roleColumn" ControlStyle-Width="300px"
DataField="ddl_item" HeaderText="Role" ItemStyle-CssClass="roleColumn" />
<asp:BoundField ControlStyle-CssClass="departmentColumn"
ControlStyle-Width="120px" DataField="dep_name" HeaderText="Department"
ItemStyle-CssClass="departmentColumn" />
</Columns>
</asp:GridView>
<span ID="lbl_chkBx_store_workunit" class="errorText"></span>
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</div>
<br />
<div>
<table>
<tr>
<td>
<asp:Label ID="lblException" runat="server" CssClass="errorText"></asp:Label>
</td>
</tr>
</table>
</div>
<br />
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<br />
<div>
<table>
<tr>
<td>
<asp:Button ID="btn_view1_back" runat="server" Text="Back" CausesValidation="False"
ValidationGroup="Form2" />
<asp:Button ID="btn_View1_Next" runat="server" CausesValidation="true" Text="Next"
ValidationGroup="Form2" OnClientClick="return check_sel();" UseSubmitBehavior="True" />
<%
'mahesh code
'replaced OnClientClick="return ValidateDropDown(); with OnClientClick="return check_sel() "
%>
</td>
</tr>
</table>
</div>
<br />
</td>
</tr>
</table>
</div>
</asp:View>
Please help #!
You say your problem is that the buttons are not into view. You can scroll your control into view by using this technique. Or you can load the page on my screen, I have a bigger monitor.
What I'm trying to say: if it's visible on your screen after redesign, anybody with a smaller screen or a resized browser window still won't see it.
If you want to-the-point help on your HTML design, I suggest you upload a trimmed down example of your problem that we can copy and paste to test (or show an online link of your current page).
Lose the tables, or at the very least, remove the unnecessary <div> and <br> tags.
Another option, provided you do not have to support old versions of Internet Explorer, is to use position: fixed to "stick" your buttons to the bottom of the viewable window.
<div style="position: fixed; bottom: 0px;">
<asp:Button ID="btn_view1_back" ... />
<asp:Button ID="btn_view1_next" ... />
</div>

Resources