Modal Pop up is not displaying update panel in asp.net - asp.net

This is my aspx page:
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TotalFee.aspx.cs" Inherits="TotalFee" %>
<%# Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript">
// function ok(sender, e) {
// alert("Hello");
// __doPostBack('btnCreateBill','btnCreateBill_Click');
// }
// function cancel(sender, e) {
// $find('ModalPopupExtender1').hide();
// }
//
</script>
<style type="text/css">
.style2
{
font-size: x-large;
font-family: "Times New Roman", Times, serif;
}
.style3
{
color: #FF0000;
}
.panel
{
position:static;
top: 80%;
left:50%;
background-color:Aqua;
}
.modalBackground
{
z-index:auto;
}
</style>
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="MainContent">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<table style="width:100%">
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="Classlabel" runat="server" Text="Class" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:DropDownList ID="ClassDropDownList" runat="server" Width="150px"
DataSourceID="SqlDataSource1" DataTextField="ClassName"
DataValueField="ClassName" AutoPostBack="True"
onselectedindexchanged="ClassDropDownList_SelectedIndexChanged">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbbilling2.0ConnectionString4 %>"
SelectCommand="SELECT [ClassName] FROM [tblClass]"></asp:SqlDataSource>
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="StudentNamelabel" runat="server" Text="StudentName" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:DropDownList ID="StudentNameDropDownList" runat="server" Width="150px"
DataSourceID="SqlDataSource2" DataTextField="StudentName"
DataValueField="StudentID" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:dbbilling2.0ConnectionString3 %>"
SelectCommand="SELECT [StudentID], [StudentName] FROM [tblStudentInfo] WHERE ([Class] = #Class)">
<SelectParameters>
<asp:ControlParameter ControlID="ClassDropDownList" Name="Class"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="Monthlabel" runat="server" Text="Month" CssClass="style2"></asp:Label>
<br />
<br />
<br />
<br />
<br />
</td>
<td valign="top" align="center">
<asp:DropDownList ID="MonthDropDownList" runat="server" Width="150px"
DataSourceID="SqlDataSource3" DataTextField="Month" AutoPostBack="true"
DataValueField="Month" OnDataBound="MonthDropDownListDataBound"
onselectedindexchanged="MonthDropDownList_SelectedIndexChanged1">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:dbbilling2.0ConnectionString2 %>"
SelectCommand="SELECT [Month] FROM [tblMonth]"></asp:SqlDataSource>
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="MonthlyFeelabel" runat="server" Text="Monthly Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtMonthlyFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="MonthlyFeeValidator" runat="server"
ControlToValidate="txtMonthlyFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="TransportFeelabel" runat="server" Text="Transport Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtTransportFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="TransportationFeeValidator" runat="server"
ControlToValidate="txtTransportFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="Hostelfeelabel" runat="server" Text="Hostel Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtHostelFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="HostelFeeValidator" runat="server"
ControlToValidate="txtHostelFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="ECAFeeLabel" runat="server" Text="ECA Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtECAFee" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator ID="ECAFeeValidator" runat="server"
ControlToValidate="txtECAFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:300px; vertical-align:top;" align="left" >
<asp:Label ID="DueFromPreviousMonthLabel" runat="server"
Text="Due From Previous Month" CssClass="style2"></asp:Label>
<br />
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtDueFromPreviousMonth" runat="server" Width="150px" Text="0"></asp:TextBox>
<asp:RequiredFieldValidator ID="DueFromPreviousMonthValidator" runat="server"
ControlToValidate="txtECAFee" CssClass="style3">*</asp:RequiredFieldValidator>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="TotalFeeLabel" runat="server" Text="Total Fee" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:TextBox ID="txtTotalFee" runat="server" Width="150px" ReadOnly="true"></asp:TextBox>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
<asp:Label ID="PaidLabel" runat="server" Text="Paid" CssClass="style2"></asp:Label>
</td>
<td valign="top" align="center">
<asp:CheckBox ID="ChkPaidLabel" runat="server" />
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" >
</td>
<td valign="top" align="right">
<asp:Button ID="btnSubmit" runat="server" Text="Submit" Width="150px"
onclick="btnSubmit_Click" />
<asp:Button ID="btnReset" runat="server" Text="Reset" Width="150px" />
<asp:Button ID="btnCreateBill" runat="server" Text="CreateBill" Width="150px"
OnClick="btnCreateBill_Click"/>
<%--<asp:PopupControlExtender ID="btnCreateBill_PopupControlExtender" OffsetX="-1100" OffsetY="115"
runat="server" DynamicServicePath="" Enabled="True" ExtenderControlID=""
TargetControlID="btnCreateBill" PopupControlID="UpdatePanel1">
</asp:PopupControlExtender>--%>
</td>
</tr>
<tr>
<td style="width:150px; vertical-align:top;" align="left" colspan="2" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ModalPopupExtender ID="ModalPopUpExtender1" runat="server" PopupControlID="UpdatePanel1"
TargetControlID="UpdatePanel1" DropShadow="false" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
<rsweb:ReportViewer ID="ReportingForPrintingReportViewer" runat="server" Visible="false" CssClass="panel"
Width="100%" Height="100%" Font-Names="Verdana" Font-Size="8pt"
InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Report.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
SelectMethod="GetData" TypeName="DataSet1TableAdapters.tblTotalFeeTableAdapter">
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Content>
and this is my cs page:
protected void btnCreateBill_Click(object sender, EventArgs e)
{
ModalPopUpExtender1.Show();
DisplayReport();
}
Why isn't UpdatePanel1 being displayed when we click btnCreateBill?? I want to show UpdatePanel1 as popup when i click btnCreateBill
When I placed modal pop up extender inside my updatepanel1 it gave the error
An extender can't be in a different UpdatePanel than the control it extends.

Because its outside the updatepanel, bring it inside the update panel to make it appear. You cannot access and change state of controls outside update panel when a event is fired in the update panel.
When a event is fired in a update panel, only controls in the update panel can be accessed and modified.
<td style="width:150px; vertical-align:top;" align="left" colspan="2" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ModalPopupExtender ID="ModalPopUpExtender1" runat="server" PopupControlID="UpdatePanel1" TargetControlID="UpdatePanel1" DropShadow="false" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
<rsweb:ReportViewer ID="ReportingForPrintingReportViewer" runat="server" Visible="false" CssClass="panel"
Width="100%" Height="100%" Font-Names="Verdana" Font-Size="8pt"
InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Report.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
SelectMethod="GetData" TypeName="DataSet1TableAdapters.tblTotalFeeTableAdapter">
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</td>

instead of using updatepanel on modalpopup panel you can try something from code behind to serve the purpose.
<asp:scriptmanager id="ScriptManager1" runat="server">
</asp:scriptmanager>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground"
CancelControlID="btnCancel" PopupControlID="Panel1"
TargetControlID="HiddenField1">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="Panel">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Height="34px" RepeatDirection="Horizontal"
Width="129px" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
AutoPostBack="True">
<asp:ListItem>Option1</asp:ListItem>
<asp:ListItem>Option2</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="txt1" runat="server"
Visible="False"></asp:TextBox>
<asp:TextBox ID="txt2" runat="server"
Visible="False"></asp:TextBox>
</asp:Panel>
===========================================
Code Behind:
===========================================
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 0)
{
txt1.Visible = true;
ModalPopupExtender1.Show();
}
else
{
txt2.Visible = true;
ModalPopupExtender1.Show();
}
}

Related

HTML formatting changes when the page is not full screen

I have an aspx page, which looks like this:
When I restore the window, the layout changes to look like this:
How do I stop this from happening? My code is below:
<%# Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
Debug="true" CodeFile="MAIN.aspx.cs" Inherits="MAIN" %>
<script type="text/javascript">
var validFilesTypes = ["jpg", "JPG", "png", "PNG", "jpeg", "gif", "GIF"];
function CheckExtension(file) {
/*global document: false */
var lbl = document.getElementById('<%=lblMessage.ClientID %>');
lbl.innerHTML = "";
var filePath = file.value;
var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase();
var isValidFile = false;
for (var i = 0; i < validFilesTypes.length; i++) {
if (ext == validFilesTypes[i]) {
isValidFile = true;
break;
}
}
if (!isValidFile) {
file.value = null;
lbl.innerHTML = "Only jpg, png and gif allowed";
// alert("Invalid File. Valid extensions are:\n\n" + validFilesTypes.join(", "));
return false;
}
return isValidFile;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<ajaxToolkit:ToolkitScriptManager EnablePartialRendering="true" runat="Server" ID="ScriptManager1" />
<br />
Change Location
<br />
<br />
<div id="divSearch" style="width: 100%; height: 35px">
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<asp:TextBox ID="txtSearch" runat="server" Width="50%"
Height="100%"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Height="100%" Text="Search" CausesValidation="false"
OnClick="btnSearch_Click" />
<ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" WatermarkText="Enter street followed by City"
runat="server" TargetControlID="txtSearch" />
<asp:AdRotator style="margin-left:250px" id="CAdRotator" runat="server" AdvertisementFile="AdRotatorFiles.xml"
Width="200px" Height="100%" Target="_blank"></asp:AdRotator>
</div>
<br />
<asp:Label ID="lblMsg" runat="server" Text="aa" Width="1%" Visible="false"></asp:Label>
<div style="overflow:hidden;">
<input type="hidden" runat="server" id="hcheckQuery" />
<div style="width:80%; float:left;">
<table>
<tr>
<td valign="top">
<table>
<tr>
<td>
<asp:GridView ID="RepDetails" style="float:none" OnRowDataBound="RowDataBound" OnRowCreated="RowCreated" Width="100%" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px">
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="divPost" style="float: right;">
<div>
<asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label> </div>
<table width="100%" class="imagetable">
<tr>
<td>
Province<asp:DropDownList ID="ddlProvince" CssClass="font1" runat="server" Width="90%">
<asp:ListItem Text="---Select---" Value="-1"></asp:ListItem>
<asp:ListItem Text="Alberta" Value="1" Selected="True"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlProvince"
InitialValue="-1" ErrorMessage="*" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
City<br />
<asp:DropDownList ID="ddlCity" CssClass="font1" runat="server" Width="90%">
<asp:ListItem Text="---Select---" Value="-1"></asp:ListItem>
<asp:ListItem Text="Edmonton" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Calgary" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlCity"
InitialValue="-1" ErrorMessage="*" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Description<asp:TextBox ID="txtDescription" CssClass="font1" TextMode="MultiLine"
runat="server" Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtDescription"
ErrorMessage="*" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Address<asp:TextBox ID="txtAddress" CssClass="font1" TextMode="MultiLine" runat="server"
Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtAddress"
ErrorMessage="*" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Rent (CAD)<asp:TextBox ID="txtRent" CssClass="font1" runat="server" Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtRent"
ErrorMessage="*" ValidationGroup="g1"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtRent"
ErrorMessage="*" ValidationExpression="\d+" ValidationGroup="g1">
</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
Email<asp:TextBox ID="txtEmail" CssClass="font1" runat="server" Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtEmail"
ErrorMessage="*" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Phone<asp:TextBox ID="txtPhone" CssClass="font1" runat="server" Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtPhone"
ErrorMessage="*" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Image<asp:FileUpload ID="fuImage" runat="server" onchange="return CheckExtension(this);" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" CssClass="font1" runat="server" BackColor="DarkKhaki"
Text="Submit" ValidationGroup="g1" OnClick="btnSubmit_Click" />
</td>
</tr>
</table>
<br />
<br />
<br />
<br />
<br />
<div style="border-style:solid; border-color:Lime">
<asp:Label ID="lblHits" runat="server" ></asp:Label>
</div>
</div>
</div>
I've tried min-width, but that didn't work.
All I had to do was to add resize jquery
Something like this
$(window).resize(function() {
if ($(window).width() <= 1200)
$("body").css("width", "130%");
else
$("body").css("width", "100%");
});

Add Master Page form values not returning on request.form

UPDATED ISSUE:
I converted some pages to use master pages and they worked fine.
When doing request.form on child page (form declaration is in master page) I get a null value (just doing Request.Form("field") returns NULL but before master pages it worked
NOTE: ALL the code worked fine before implementing master pages!!
The button code is:
<asp:Button ID="btnPACheck" runat="server" Text="<%$Resources:share,btnPACheck %>" onclick="btnPACheck_Click" />
The view soruce on the html page for the button is:
<input type="submit" name="ctl00$ContentPlaceHolder1$btnPACheck" value="Continue" id="ctl00_ContentPlaceHolder1_btnPACheck" />
The onclick code is long but it is declared like this (and first line has the debug line placed on it and it is not getting to it):
protected void btnPACheck_Click(object sender, EventArgs e)
{
bool validPA = false;
Master page is below:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MasterPageSiteWide.master.cs" Inherits="MasterPageSiteWide" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%# Register src="~/ucBanner.ascx" TagName="Banner" TagPrefix="ucBanner" %>
<!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">
body {
background: url(page-bg.gif) repeat-x top left #5997C8;
CLIP: rect(19px 65px 50px 10px);
margin-top: 10px;
margin-bottom:30px;
margin-right: 40px;
margin-left: 60px;
width:80%;
}
TD.bluerow {
height: .10pc;
background-color: #000066;
}
TD.medbluerow {
height: .0005pc;
background-color: #6699CC;
}
.panel_with_padding {
padding-top:10px;
padding-left:10px;
padding-right:10px;
padding-bottom:10px;
}
</style>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server" method="post">
<asp:ScriptManager ID="ScriptManager1" EnableScriptGlobalization="true" EnableScriptLocalization="true" runat="server"></asp:ScriptManager>
<asp:RoundedCornersExtender Corners="All" TargetControlID="MainPanel" BorderColor="Black" ID="RoundedCornersExtender1" runat="server"></asp:RoundedCornersExtender>
<asp:Panel BackColor="White" runat="server" ID="MainPanel" CssClass="panel_with_padding">
<div>
<br />
<div>
<asp:Label ID="lblTopHeading" runat="server" Font-Bold="true" Font-Size="X-Large" Text=""></asp:Label>
</div>
<br />
<ucBanner:Banner ID="bannerStrip" runat="server"></ucBanner:Banner>
<br />
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<br /><br />
<hr />
<div>
© Copyright 20xx-2012, Ford Motor Company. All rights reserved.
</div>
</asp:Panel>
</form>
</body>
</html>
Content page (part of cant post whole thing too long) where button is:
<%# Page Language="C#" MasterPageFile="~/MasterPageSiteWide.master" AutoEventWireup="true" CodeFile="initial.aspx.cs" ValidateRequest="false" Inherits="initial" UICulture="auto"%>
<%# MasterType virtualPath="~/MasterPageSiteWide.master"%>
<%# Register src="~/ucBanner.ascx" TagName="Banner" TagPrefix="ucBanner" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<title>Hotline - Dealer Prior Approval - Begin</title>
<link href="Styles/dpaStyles.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
function OpenPopUp() {
window.open("collectvin.aspx", "List", "scrollbars=no,resizable=no,width=400,height=350");
}
function InvokePop(vin) {
val = document.getElementById(vin).value;
// to handle in IE 7.0
if (window.showModalDialog) {
retVal = window.showModalDialog("collectvin.aspx?Control1=" + vin + "&ControlVal=" + val, 'Show Popup Window', "dialogHeight:90px,dialogWidth:250px,resizable:yes,center:yes,");
document.getElementById(vin).value = retVal;
}
}
function checkChoice() {
var hasFound = false
for (i = 0; i < document.secpaform.SecPACode.length; i++) {
if (document.secpaform.SecPACode[i].checked == true) {
hasFound = true
break;
}
}
if (!hasFound) {
alert("Please select one...")
document.secpaform.SecPACode[0].focus();
return false
}
else
return true
}
function checkOldVin() {
//alert('inside checkOldVin');
if (frmInitial.txtOldVin.value == '') {
alert('Please enter the VIN for an older vehicle!!!');
frmInitial.txtOldVin.focus();
return false;
}
var alphanumeric = /^[0-9a-zA-Z]+$/;
if (!frmInitial.txtOldVin.value.match(alphanumeric)) {
alert('VIN must be numbers and letters only!');
frmInitial.txtOldVin.focus();
return false;
}
return true;
}
function checkPartChoice() {
//alert('in checkPartsChoice');
}
</script>
<style type="text/css">
body {
background: url(page-bg.gif) repeat-x top left #5997C8;
CLIP: rect(19px 65px 50px 10px);
margin-top: 10px;
margin-bottom:30px;
margin-right: 40px;
margin-left: 60px;
width:80%;
}
TD.bluerow {
height: .10pc;
background-color: #000066;
}
TD.medbluerow {
height: .0005pc;
background-color: #6699CC;
}
p.MsoNormal
{margin-top:0in;
margin-right:0in;
margin-bottom:10.0pt;
margin-left:0in;
line-height:115%;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<!-- -------------------------->
<!-- start outer table, rounded corners -->
<!-- -------------------------->
<table style="width: 95%;" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="8" height="11" bgcolor="#ffffff"><img src="images/ccbackground/HLEFT.jpg" alt=""/></td>
<td bgcolor="#ffffff" background="images/ccbackground/TOPbg.jpg"><img src="images/ccbackground/TOPbg.jpg" alt=""/></td>
<td width="8" height="11" bgcolor="#ffffff"><img src="images/ccbackground/HRIGHT.jpg" alt=""/></td>
</tr>
<tr>
<td width="8" background="images/ccbackground/LEFTbg.jpg"><img src="images/ccbackground/LEFTbg.jpg" alt=""/></td>
<td align="center" height="800" valign="top" bgcolor="white" >
<div>
<asp:Label ID="lblTopHeading" runat="server" Font-Bold="true" Font-Size="X-Large" Text="<%$Resources:share,lblTopHeading %>" EnableViewState="false"></asp:Label>
</div>
<!-- -------------------------->
<!-- begin main page content -->
<!-- -------------------------->
<asp:UpdatePanel ID="tryUP" runat="server">
<ContentTemplate>
<table width="100%" align="center" style="font-size:14px; font-family:Verdana,Arial;">
<tr align="center">
<td align="center" >
<br />
<ucBanner:Banner ID="bannerStrip" runat="server"></ucBanner:Banner>
<asp:LinkButton ID="LinkButton1" Text="English" Visible="false" runat="server" onclick="LinkButton1_Click"></asp:LinkButton><br />
<asp:Label ID="Label22" runat="server" Font-Size="Small" Text="<%$Resources:share,lblpartstatement %>" EnableViewState="false"></asp:Label>
<br />
<asp:LinkButton ID="LinkButton2" Text="<%$Resources:share,lblPartsList %>" Visible="true" runat="server" ></asp:LinkButton>
<br />
</td>
</tr>
<tr>
<td style="font-size:10px; padding-left:130px;">
<asp:Label ID="lblInitialHeading" runat="server" Font-Bold="true" Text="" EnableViewState="false"></asp:Label>
</td>
<td align="center" valign="top">
<asp:Label ID="Label1" runat="server" Font-Bold="true" Font-Size="Large" Text=""></asp:Label>
</td>
</tr>
<tr align="center">
<td align="center">
<div id="Div1" class="example1" runat="server" visible="true" >
<a href="javascript:window.close();" style="color:Red; float:right">
<span>
<asp:Label ID="lblClose" Font-Names="Verdana" Font-Size="Medium" runat="server" Text="<%$ Resources:share,lblClose %>"></asp:Label>
</span>
</a>
</div>
</td>
</tr>
<tr align="center">
<td align="center" valign="top" style="font-size:16px; font-family:Verdana,Tahoma; font-weight:bold">
<div id="divButtons" runat="server" visible="true" >
<asp:Label ID="lblPAtypeheading" runat="server" Font-Names="Verdana" Text="<%$ Resources:share,lblPAtypeheading %>"></asp:Label> <asp:Label ID="lblPAtype" Font-Names="Verdana" runat="server" Font-Underline="true" Text=""></asp:Label>
</div>
</td>
</tr>
</table>
<br />
<div id="divPAnotrequired" runat="server" visible="false">
<asp:Label ID="lblNotRequired" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblPANotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divRADnotrequired" runat="server" visible="false">
<asp:Label ID="Label5" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblRADNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divCHMSLnotrequired" runat="server" visible="false">
<asp:Label ID="Label7" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblCHMSLNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divTaurusRearLampNotRequired" runat="server" visible="false">
<asp:Label ID="Label11" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblTaurusRearLampNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divRangerChatterNotRequired" runat="server" visible="false">
<asp:Label ID="Label15" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblRangerChatterNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divFlexSqueakNotRequired" runat="server" visible="false">
<asp:Label ID="Label16" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblFlexSqueakNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divEscapeNoiseNotRequired" runat="server" visible="false">
<asp:Label ID="Label17" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblEscapeNoiseNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divFiestaGlassNotRequired" runat="server" visible="false">
<asp:Label ID="Label18" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblFiestaGlassNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divScratchesNotRequired" runat="server" visible="false">
<asp:Label ID="Label20" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblScratchesNotRequired %>" EnableViewState="false"></asp:Label>
<br />
</div>
<div id="divCostCap" runat="server" visible="false">
<asp:Label ID="lblCostCap" runat="server" Font-Size="Medium" Font-Names="Verdana" ForeColor="IndianRed" Font-Bold="true" Text="<%$Resources:share,lblCostCap %>" EnableViewState="false"></asp:Label>
<div id="closeButtonDiv" class="closeButton" runat="server" visible="true" >
</div>
</div>
<div id="divRadMileage" runat="server" visible="false">
<div class="medBlueRow" style="width:700px; height:2px;"></div>
<table width="90%" align="center" style="font-size:14px; font-family:Verdana,Arial;">
<tr>
<td style="font-size:16px; font-family:Verdana,Tahoma; font-weight:bold">
<asp:Label ID="Label4" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblRadMileage %>" EnableViewState="false"></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="font-size:12px; font-family:Verdana,Tahoma; font-weight:bold" height="125" valign="middle">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" OnSelectedIndexChanged="btnIndexchange_Click" AutoPostBack="True">
<asp:ListItem Text="<%$Resources:share,lblYes %>" Value="yes"></asp:ListItem>
<asp:ListItem Text="<%$Resources:share,lblNo %>" Value="no"></asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Button ID="Button1" runat="server" Visible="false" Text="<%$Resources:share,btnDslParts %>" />
<br /><br />
</td>
</tr>
</table>
</div>
<div id="divCHMSL" runat="server" visible="false">
<table width="90%" align="center" style="font-size:14px; font-family:Verdana,Arial;">
<tr>
<td style="font-size:16px; font-family:Verdana,Tahoma; font-weight:bold">
<asp:Label ID="Label6" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblCHMSL %>" EnableViewState="false"></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="font-size:12px; font-family:Verdana,Tahoma; font-weight:bold" valign="middle">
<asp:RadioButtonList ID="RadioButtonList2" runat="server" OnSelectedIndexChanged="btnIndexchangeCHMSL_Click" AutoPostBack="True">
<asp:ListItem Text="<%$Resources:share,lblCHMSLYes %>" Value="yes"></asp:ListItem>
<asp:ListItem Text="<%$Resources:share,lblCHMSLNo %>" Value="no"></asp:ListItem>
</asp:RadioButtonList>
Found Solution: Found the issue.
The form was doing Request. Form and that was returning NULL for all the values.
I just changed it to do the formfield.value instead of request.form("FormField")
This solved the issue.
Sorry for initial confusion on what the initial issue was.

While or For loop in asp.net

How do I use a For loop in asp.net inside the below? I have tried to use <% for(int i=0; i<5; i++)%> which gives me syntax error.
I am getting tired of the message "Oops! Your edit couldn't be submitted because:"
<asp:ListView runat="server" ID="EmployeesListView" DataSourceID="EmployeesDataSource" DataKeyNames="EmployeeID" OnDataBound="grd_RowDataBound">
<LayoutTemplate>
<table cellpadding="2" runat="server" id="tblEmployees" name="tblEmployees" style="width:100%" color="green">
<tr id="Tr3" runat="server" style="background-color: red; color: yellow">
<th id="lbl1" style="display:none">Record No.</th>
</tr>
<tr runat="server" id="itemPlaceholder"></tr>
</table>
<asp:DataPager runat="server" ID="DataPager" PageSize="5">
<Fields>
<asp:NumericPagerField ButtonCount="5" PreviousPageText="<--" NextPageText="-->" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<td valign="top" class="tdWithBorder" width="165" align="right" style="background-color: #D7E0EC; color: blue">
<asp:Label ID="lblCallStatus" runat="server" Text='Call Status' />
<br />
<asp:Label ID="lblHoursWorked1" runat="server" Text='HoursWorked' />
<br />
<asp:Label ID="lblOTMealsPaid" runat="server" Text='Meals Paid'/>
<br />
</td>
</tr>
</ItemTemplate>
Look at the code-behind here
http://everymanprogrammer.com/index.php/nested-repeaters-do-it-clean-and-simple-a-beginners-tutorial-part-1/

Modalpopup wont close when dropdown is selected

I've been having this odd issue with modal popups. For some reason when I choose a dropdown item my update button wont fire a click event. but then I leave the dropdown at their default values the update button works just fine.
here's my aspx page code
<asp:Button ID="Button1" CssClass="hide" runat="server" Text="Button" />
<ajaxToolkit:ModalPopupExtender runat="server" ID="cfPopUp" PopupControlID="Panel4"
TargetControlID="Button1" OkControlID="cfUpdateBtn" CancelControlID="cfCancelBtn" />
<asp:Panel ID="Panel4" runat="server" CssClass="modalPopup">
<asp:UpdatePanel ID="UpdatePanel2" runat="Server">
<ContentTemplate>
<asp:Panel ID="Panel13" CssClass="" runat="server">
<asp:Panel ID="Panel14" CssClass="" runat="server">
<div style="padding: 10px; border: 3px solid black; background-color: White; color: Black;">
<asp:Label ID="Label25" Width="200px" runat="server" Text="Health and Safety Net" /><div
class="seperator">
</div>
<table class="style143">
<tr>
<td class="style185">
<asp:Label ID="cfCategorylbl" runat="server" Text="Category:"></asp:Label>:
</td>
<td>
<asp:DropDownList ID="cbFactors_Categories" runat="server" Width="350px" Font-Names="Tahoma"
Font-Size="Small" ForeColor="DimGray" Height="24px" CssClass="style75">
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="CascadingDropDown3" runat="server" TargetControlID="cbFactors_Categories"
Category="categories" ServiceMethod="getCategory" ServicePath="~/2012/IrSubmitWebService.asmx"
PromptText="Select Category" />
</td>
<td align="center" rowspan="3" valign="top">
<asp:Label ID="lblFactor_ID" runat="server" Font-Names="Tahoma" Font-Size="Small"
ForeColor="DimGray" Style="font-style: italic" TabIndex="56"></asp:Label>
<cc1:DynamicPopulateExtender ID="lblFactor_ID_DynamicPopulateExtender" runat="server"
Enabled="True" TargetControlID="lblFactor_ID" BehaviorID="dp1" ServiceMethod="getFactorID"
ServicePath="~/2012/IrSubmitWebService.asmx">
</cc1:DynamicPopulateExtender>
<hr class="style157" />
<asp:Label ID="cfID" runat="server" Font-Names="Tahoma" Font-Size="Small" ForeColor="DimGray"
Style="font-style: italic" Width="400px" TabIndex="57"></asp:Label>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label ID="cfTypeslbl" runat="server" Text="Type:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cbFactors_Types" runat="server" ForeColor="DimGray" Height="24px"
TabIndex="54" Width="350px" Font-Names="Tahoma" Font-Size="Small" CssClass="style75">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cbFactors_Types_CascadingDropDown" runat="server"
TargetControlID="cbFactors_Types" ParentControlID="cbFactors_Categories" Category="type"
ServiceMethod="getTypeofAction" ServicePath="~/2012/IrSubmitWebService.asmx"
PromptText="Select Type">
</cc1:CascadingDropDown>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label ID="cfFactorslbl" runat="server" Text="Factor:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cbFactors_Factors" runat="server" ForeColor="DimGray" Height="24px"
TabIndex="55" Width="350px" Font-Names="tahoma" Font-Size="Small" CssClass="style75">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cbFactors_Factors_CascadingDropDown" runat="server"
TargetControlID="cbFactors_Factors" ParentControlID="cbFactors_Types" Category="category"
ServiceMethod="getFactor" ServicePath="~/2012/IrSubmitWebService.asmx" PromptText="Select Factor">
</cc1:CascadingDropDown>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label Text="Justification:" ID="cfJustificationlbl" runat="server"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="txtJustification" runat="server" ForeColor="DimGray" Height="29px"
Style="font-family: Tahoma; font-size: small" TabIndex="56" TextMode="MultiLine"
ToolTip="Provide a justification for this factor." Width="775px" Font-Names="Tahoma"
Font-Size="Small"></asp:TextBox>
</td>
</tr>
</table>
<br />
<div style="text-align: center">
<asp:Button CausesValidation="false" ID="cfUpdateBtn" runat="server"
Text="Update" CssClass="button" /><span style="margin-left: 10px"><asp:Button CausesValidation="false"
ID="cfCancelBtn" runat="server" Text="Cancel" CssClass="button" /></span></div>
</div>
</asp:Panel>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
and my code behind for my update (it just closes the popup)
Protected Sub cfUpdateBtn_Click(sender As Object, e As EventArgs) Handles cfUpdateBtn.Click
cfPopUp.Hide()
End Sub
For the life of me I can't figure out why the update button wont work when the dropdowns are not the default value.
Thanks for your help guys
The possible reason may be you are binding your dropdownlist with a webservice. Whenever you click to an item on dropdownlist webservice may be called. If webservice is called then may be your page again loaded ? I don't know the exact reason why it is not working. You have to check the service behavior what happened when the service is called.
I basically rebuilt my modal popup and update panel like so
<asp:Panel ID="pnlEditPopup" runat="server" CssClass="modalPopup">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlEditPopupContent" runat="server">
<div style="padding: 10px; border: 3px solid black; background-color: White; color: Black;">
<table cellpadding="0" cellspacing="4" border="0">
<tr>
<td class="name">Category:</td>
<td class="value">
<asp:DropDownList id="ddCat" runat="server">
<asp:listitem value="">No Selection</asp:listitem>
<asp:listitem value="Action">Action</asp:listitem>
<asp:listitem value="Worksite">Worksite</asp:listitem>
<asp:listitem value="Human Factors">Human Factors</asp:listitem>
<asp:listitem value="System Factors">System Factors</asp:listitem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="name">Type:</td>
<td class="value">
<asp:DropDownList id="ddType" runat="server" />
<ajaxToolkit:CascadingDropDown ID="ccType" runat="server"
TargetControlID="ddType"
ParentControlID="ddCat"
PromptText="No Selection"
LoadingText="Please Wait..."
ServicePath="~/2012/IrSubmitWebService.asmx"
ServiceMethod="getTypeofAction"
Category="Other"
/>
</td>
</tr>
<tr>
<td class="name">Factor:</td>
<td class="value">
<asp:DropDownList id="ddfactor" runat="server" />
<ajaxToolkit:CascadingDropDown ID="ccFactor" runat="server"
TargetControlID="ddfactor"
ParentControlID="ddType"
PromptText="No Selection"
LoadingText="Please Wait..."
ServicePath="~/2012/IrSubmitWebService.asmx"
ServiceMethod="getFactor"
Category="Other"
/>
</td>
</tr>
<tr>
<td>
Justification:
<asp:Label ID="factorID" runat="server" Visible="false"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtJustification" runat="server" ForeColor="DimGray" Height="100px"
Style="font-family: Tahoma; font-size: small" TabIndex="56" TextMode="MultiLine"
ToolTip="Provide a justification for this factor." Width="300px" Font-Names="Tahoma"
Font-Size="Small"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Factor ID<br />
and Description:
</td>
<td>
<asp:Label ID="factor_id_Desc" runat="server" Width="300px" Font-Names="Tahoma" Font-Size="Small"
ForeColor="DimGray" TabIndex="56"></asp:Label>
<cc1:DynamicPopulateExtender ID="DynamicPopulateExtender1" runat="server"
Enabled="True" TargetControlID="factor_id_Desc" BehaviorID="dp1" ServiceMethod="getFactorID"
ServicePath="~/2012/IrSubmitWebService.asmx">
</cc1:DynamicPopulateExtender>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="btnOkEditPopup" runat="server" Text="Ok" CssClass="button"/>
<span style="margin-left:10px"><asp:button id="btnCancelEditPopup" runat="server" text="Cancel" CssClass="button"/></span>
</td>
</tr>
</table>
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="mpeEdit" runat="server"
TargetControlID="btnOpenEditPopup"
PopupControlID="pnlEditPopup"
/>
Fixed my issue. I still dont know why it wasn't working when I asked the question but I was able to solve it. Thanks to all who looked into it for me.

Ajax ModelpopupExtender Cant work

I am using modelpopupextender in asp.net and this code is working window is popup sucessfuly but cancel button can't work; can anybody tell me why?
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp"
%>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Button ID="buttonOpen" runat="server" style="display:none" ></asp:Button>
<asp:Panel ID="Panel3" runat="server" BackColor="#99CCFF" Height="269px" Width="350px"
style="display:none">
<table width="100%" style="border:Solid 3px #D55500; width:100%; height:100%"
cellpadding="0" cellspacing="0">
<tr style="background-color:#333399">
<td colspan="2" style=" height:10%; color:White; font-weight:bold; font-size:larger"
align="center">Time Details</td>
</tr>
<tr>
<td>
<asp:Label ID="Label19" runat="server" Text="Time From"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label20" runat="server" Text="Time To"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label21" runat="server" Text="Number of Slots"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="Add" />
</td>
<td>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" OnCancelScript="btnCancel" PopupControlID="panel3" TargetControlID="buttonOpen" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
You need to set the CancelControlID property, not the OnCancelScript property (unless you want to execute a script after the cancel button is clicked). So for your scenario, do this:
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="btnCancel" PopupControlID="panel3" TargetControlID="buttonOpen" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>

Resources