HTML formatting changes when the page is not full screen - css

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%");
});

Related

ASP.NET Webforms Error When Trying to Update SQL Data

my question is about how to go about updating data in a ASP.NET listview using a stored procedure.
I'm getting an error message whenever I try to update any data in my listview stating that my stored procedure has too many arguments specified.
I've looked through all of my code and all of my arguments seem to match up with my stored procedure so I think it might have to do with how I created the listview (just dragging and dropping it in design view using visual studio 2015) or it's something wrong with my stored procedure.
I've been stuck on this issue for about a day now and I feel like I'm missing something real simple here but can't quite put my finger on it.
If anyone could help my out I would greatly appreciate it. This app I'm working on uses vb.net as it's back-end and used ASP.NET web forms. Below is the code for the page I'm working on.
ASP.NET Page (Might not work properly since it uses a master page and some other external resources)
<%# Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPages/MasterPage.Master" CodeBehind="CodeManagement.aspx.vb" Inherits="OcasNS.CodeManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderInHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPH1_DontUseInAContentPageItsJustForTheseJavaScriptFiles" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p>Course Code:<asp:TextBox ID="TextBox1" runat="server" Height="18px"></asp:TextBox>
</p>
<br />
<p>Course Title:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<br />
<p>Class/Group:<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
</p>
<p>Career Tech Course Type:
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
</p>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:OKECSTestConnectionString %>" SelectCommand="spCodeManagementLookup" SelectCommandType="StoredProcedure" UpdateCommand="spCodeManagementUpdate" UpdateCommandType="StoredProcedure">
<UpdateParameters>
<asp:Parameter Name="ClassGroupID" Type="Int32" />
<asp:Parameter Name="CourseDescription" Type="String" />
<asp:Parameter Name="ClassSubjectCode" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:ListView ID="ListView1" runat="server" DataKeyNames="ClassGroupID" DataSourceID="SqlDataSource1">
<AlternatingItemTemplate>
<tr style="background-color:#FFF8DC;">
<td>
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
</td>
<td>
<asp:Label ID="ClassGroupIDLabel" runat="server" Text='<%# Eval("ClassGroupID") %>' />
</td>
<td>
<asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />
</td>
<td>
<asp:Label ID="ClassSubjectCodeLabel" runat="server" Text='<%# Eval("ClassSubjectCode") %>' />
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="background-color:#008A8C;color: #FFFFFF;">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
</td>
<td>
<asp:Label ID="ClassGroupIDLabel1" runat="server" Text='<%# Eval("ClassGroupID") %>' />
</td>
<td>
<asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' />
</td>
<td>
<asp:TextBox ID="ClassSubjectCodeTextBox" runat="server" Text='<%# Bind("ClassSubjectCode") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table runat="server" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
<tr>
<td>No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
</td>
<td> </td>
<td>
<asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' />
</td>
<td>
<asp:TextBox ID="ClassSubjectCodeTextBox" runat="server" Text='<%# Bind("ClassSubjectCode") %>' />
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color:#DCDCDC;color: #000000;">
<td>
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
</td>
<td>
<asp:Label ID="ClassGroupIDLabel" runat="server" Text='<%# Eval("ClassGroupID") %>' />
</td>
<td>
<asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />
</td>
<td>
<asp:Label ID="ClassSubjectCodeLabel" runat="server" Text='<%# Eval("ClassSubjectCode") %>' />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr runat="server" style="background-color:#DCDCDC;color: #000000;">
<th runat="server"></th>
<th runat="server">ClassGroupID</th>
<th runat="server">Description</th>
<th runat="server">ClassSubjectCode</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
<td>
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
</td>
<td>
<asp:Label ID="ClassGroupIDLabel" runat="server" Text='<%# Eval("ClassGroupID") %>' />
</td>
<td>
<asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />
</td>
<td>
<asp:Label ID="ClassSubjectCodeLabel" runat="server" Text='<%# Eval("ClassSubjectCode") %>' />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:CommandField ShowEditButton="True" />
</Columns>
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
<br />
<br />
<button type="button">Save</button>
<button type="button">Cancel</button>
<button type="button">Export To Excel</button>
</asp:Content>
Update Stored Procedure (The one causing the error)
#ClassGroupID INT,
#CourseDescription VARCHAR(100),
#ClassSubjectCode VARCHAR(20)
UPDATE [dbo].[tb_oecs_CodeClassGroup]
SET [Description] = #CourseDescription
, [ClassSubjectCode] = #ClassSubjectCode
WHERE ClassGroupID = #ClassGroupID
Lookup Stored Procedure (This loads the data into the Listview)
SELECT DISTINCT
g.ClassGroupID
,g.Description
,g.ClassSubjectCode
FROM tb_oecs_CodeClassGroup g
JOIN tb_oecs_CodeClass c
ON g.ClassGroupID = c.ClassGroupID
ORDER BY g.ClassGroupID

Dropdown List issue in ASP Panel control

I am using asp Panel control in which I have a dropdown list for different Timezones to select.
However, When I select any timezone It disappears when I open the pop up next time.
Can you please suggest or provide some pointers ?
<asp:PlaceHolder ID="DisplayMode" runat="server">
<div id="ListBranch" style="text-align: left">
<asp:Button ID="AddBranch" runat="server" Text="Add Branch" OnClick="AddBranch_Click" />
<act:ModalPopupExtender ID="ModalPopupExtenderBranch" runat="server" TargetControlID="AddBranch" PopupControlID="pnlAddBranch"
CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
</act:ModalPopupExtender>
<act:ToolkitScriptManager ID="smBranch" runat="server">
</act:ToolkitScriptManager>
<div>
<br />
<asp:GridView runat="server" ID="gvBranchList" DataKeyNames="BranchID" AutoGenerateColumns="false" Font-Size="Small">
<RowStyle BackColor="#EFF3FB" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="Branch Name" HeaderText="Branch Name" />
<asp:BoundField DataField="Timezone" HeaderText="Timezone" />
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:Button ID="Edit" runat="server" Text="Edit" OnClick="Edit_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Label ID="lblresult" runat="server" />
<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
<asp:Button ID="UpdateBranch" CommandName="Update" runat="server" Text="Ok" OnClick="Ok_Click" Style="display: none" />
<asp:Panel ID="pnlAddBranch" runat="server" BackColor="White" Height="80%" Width="100%" Font-Size="Small" Style="top: 40px !important;">
<table style="border: solid 2px #336699; width: 100%; height: 100%; font-size: small;" cellpadding="0" cellspacing="0">
<tr style="background-color: #336699">
<td colspan="2" style="height: 5%; color: White; font-weight: bold; font-size: larger" align="center">Branch Details</td>
</tr>
<tr>
<td align="left">Branch Name: </td>
<td>
<asp:TextBox ID="BranchName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">Timezone: </td>
<td>
<asp:DropDownList ID="ddlTimezones" AutoPostBack="false" OnSelectedIndexChanged="ddlTimezones_SelectedIndexChanged" runat="server" />
</td>
</tr>
<tr>
<td align="left">Assigned Holidays: </td>
<td>
<asp:CheckBoxList ID="chkAssignedHolidays" runat="server" RepeatColumns="3" Font-Size="Small" />
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="Ok" CommandName="Add" runat="server" Text="Ok" OnClick="Ok_Click" />
<asp:Button ID="Cancel" Commandname="Cancel" runat="server" Text="Cancel" OnClick="Cancel_Click" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="lblBranchID" runat="server" Style="display: none"></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</div>
</div>
</asp:PlaceHolder>

UpdatePanel buttons fires onclick_event once only

Here Is The Code, I'll Explain it better at the end of the post
<div class="container">
<br />
<div id="infoCli" class="well" style="height: auto; width: auto;">
<table>
<tr>
<td>
<asp:Label runat="server" AssociatedControlID="cdCli" Enabled="False">Código</asp:Label>
<br />
<asp:TextBox runat="server" ID="cdCli" Width="40px" ReadOnly="True" />
</td>
<td class="auto-style39">
<asp:Label runat="server" AssociatedControlID="nmFantasia">Nome Fantasia</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvNmFantasia" ControlToValidate="nmFantasia" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nmFantasia" Width="368px" MaxLength="30" TabIndex="1" />
</td>
<td>
<asp:Label runat="server" AssociatedControlID="nmCli">Razão Social</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvNmCli" ControlToValidate="nmCli" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nmCli" Width="589px" TabIndex="2" />
</td>
</tr>
</table>
<table>
<tr>
<td class="auto-style42">
<asp:Label runat="server" AssociatedControlID="tpCli">Tipo de Cliente</asp:Label>
<br />
<asp:DropDownList ID="tpCli" runat="server" Height="25px" Width="145px" TabIndex="3" Enabled="False">
<asp:ListItem Value="0">Somente Consulta</asp:ListItem>
<asp:ListItem Value="1">Eventual</asp:ListItem>
<asp:ListItem Value="2">C/ Contrato</asp:ListItem>
</asp:DropDownList>
</td>
<td class="auto-style54">
<asp:Label runat="server" AssociatedControlID="nrCGC">CNPJ</asp:Label>
<br />
<asp:TextBox runat="server" ID="nrCGC" Width="138px" TabIndex="4" />
</td>
<td class="auto-style69">
<asp:Label runat="server" AssociatedControlID="nrCPF">CPF</asp:Label>
<br />
<asp:TextBox runat="server" ID="nrCPF" Width="110px" TabIndex="5" />
</td>
<td class="auto-style43">
<asp:Label runat="server" AssociatedControlID="nrCGF">CGF</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvNmCGF" ControlToValidate="nrCGF" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nrCGF" Width="134px" TabIndex="6" />
</td>
<td class="auto-style32">
<asp:Label runat="server" AssociatedControlID="CheckBox1" TabIndex="7">Isento
<br />
<asp:CheckBox ID="CheckBox1" runat="server" />
</asp:Label>
</td>
<td class="auto-style56">
<asp:Label runat="server" AssociatedControlID="inscMun">Insc. Mun</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvInscMun" ControlToValidate="inscMun" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="inscMun" Width="106px" TabIndex="8" />
</td>
<td class="auto-style55">
<asp:Label runat="server" AssociatedControlID="nrCEI">CEI</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvNmCEI" ControlToValidate="nrCEI" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nrCEI" Width="133px" TabIndex="9" />
</td>
</tr>
</table>
<table>
<tr>
<td class="auto-style66">
<asp:Label runat="server" AssociatedControlID="nrCep">CEP</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvNmCep" ControlToValidate="nrCep" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ToolTip="A Consulta ao CEP só será realizada caso esteja conectado à internet" ID="nrCep" onblur="Javascript:atualizacep(this.value)" Width="98px" TabIndex="10" data-mask="99999-999" />
</td>
<td>
<asp:Label runat="server" AssociatedControlID="dsEnder">Endereço</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvDsEnder" ControlToValidate="dsEnder" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="dsEnder" Width="377px" TabIndex="11" />
</td>
<td class="auto-style46">
<asp:Label runat="server" AssociatedControlID="nrEnder">Número</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvNrEnder" ControlToValidate="nrEnder" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nrEnder" Width="46px" TabIndex="12" />
</td>
<td class="auto-style68">
<asp:Label runat="server" AssociatedControlID="dsBairro">Bairro</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvDsBairro" ControlToValidate="dsBairro" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="dsBairro" Width="196px" TabIndex="13" />
</td>
<td class="auto-style25">
<asp:Label runat="server" AssociatedControlID="compEnder">Complemento</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvCompEnder" ControlToValidate="compEnder" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="compEnder" Width="141px" TabIndex="14" />
</td>
</tr>
</table>
<table>
<tr>
<td class="auto-style43">
<asp:Label runat="server" AssociatedControlID="dsCid">Cidade</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvDsCid" ControlToValidate="dsCid" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="dsCid" Width="414px" TabIndex="15" />
</td>
<td class="auto-style51"> <asp:Label runat="server" AssociatedControlID="cdUF">UF</asp:Label>
<asp:RequiredFieldValidator ID="rfvCdUF" runat="server" ControlToValidate="cdUF" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="cdUF" Width="34px" TabIndex="166" />
</td>
<td class="auto-style48">
<asp:Label runat="server" AssociatedControlID="foCli">Telefone</asp:Label>
<asp:RequiredFieldValidator ID="rfvFoCli" runat="server" ControlToValidate="foCli" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="foCli" Width="122px" TabIndex="17" />
</td>
<td class="auto-style19">
<asp:Label runat="server" AssociatedControlID="nrFax">Fax</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvNrFax" ControlToValidate="nrFax" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nrFax" Width="126px" TabIndex="18" />
</td>
</tr>
</table>
<table>
<tr>
<td class="auto-style57">
<asp:Label runat="server" AssociatedControlID="cdIBGE" Width="133px">Cód. Cidade IBGE</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvCdIBGE" ControlToValidate="cdIBGE" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="cdIBGE" Width="113px" TabIndex="19" />
</td>
<td class="auto-style52">
<asp:Label runat="server" AssociatedControlID="cdNatOpe" Width="170px">Natureza da Operação</asp:Label>
<asp:RequiredFieldValidator runat="server" ID="rfvCdNatOpe" ControlToValidate="cdNatOpe" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:DropDownList ID="cdNatOpe" runat="server" Height="25px" Width="404px" TabIndex="20">
<asp:ListItem Value="0">(escolha uma opção):</asp:ListItem>
<asp:ListItem Value="1">Tributação No Município</asp:ListItem>
<asp:ListItem Value="2">Tributação Fora do Município</asp:ListItem>
<asp:ListItem Value="3">Isenção</asp:ListItem>
<asp:ListItem Value="4">Imune</asp:ListItem>
<asp:ListItem Value="5">Exigibilidade Suspensa por Decisão Judicial</asp:ListItem>
<asp:ListItem Value="6">Exigibilidade Suspensa por Procedimento Administrativo</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<div class="container">
<div class="container">
<div class="row">
<div class="checkbox">
<label for="CheckBox2">
<asp:CheckBox ID="CheckBox2" runat="server" TabIndex="22" />
Simples Nacional
</label>
<label for="CheckBox3">
<asp:CheckBox ID="CheckBox3" runat="server" />
Inadiplente
</label>
<label for="CheckBox4">
<asp:CheckBox ID="CheckBox4" runat="server" TabIndex="23" />
Incentivador Cultural
</label>
<label for="CheckBox5">
<asp:CheckBox ID="CheckBox5" runat="server" TabIndex="24" />
Inativo
</label>
</div>
<br />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6 pull-right">
<asp:Button CssClass="btn btn-default" ID="btnCons" runat="server" Text="Consultar" OnClick="Consultar" CausesValidation="false" />
<asp:Button CssClass="btn btn-default" ID="btnInse" runat="server" Text="Inserir" OnClick="Inserir" CausesValidation="false" />
<asp:LinkButton runat="server" OnClick="Consultar" CausesValidation="false" >Consultar</asp:LinkButton>
</div>
</div>
</div>
<%--DIV - WELL--%>
<br />
<div id="endCob" class="well" style="height: auto; width: auto;">
<div class="checkbox-inline">
<label for="CheckBox7" class="checkbox-inline">
<asp:CheckBox ID="checkEndeCob" OnClick="Javascript:checkEndCob()" runat="server" TabIndex="25" />
Endereço do cliente é o mesmo que o Endereço de Cobrança
</label>
</div>
<table>
<tr>
<td class="auto-style28">
<asp:Label runat="server" AssociatedControlID="nrCepCob">CEP</asp:Label>
<br />
<asp:TextBox runat="server" ID="nrCepCob" onblur="Javascript:atualizacep(this.value)" Width="98px" TabIndex="26" />
</td>
<td class="auto-style29">
<asp:Label runat="server" AssociatedControlID="dsEnderCob">Endereço</asp:Label>
<br />
<asp:TextBox runat="server" ID="dsEnderCob" Width="373px" TabIndex="27" />
</td>
<td class="auto-style40">
<asp:Label runat="server" AssociatedControlID="nrEnderCob">Número</asp:Label>
<br />
<asp:TextBox runat="server" ID="nrEnderCob" Width="38px" TabIndex="28" />
</td>
<td class="auto-style31">
<asp:Label runat="server" AssociatedControlID="dsBairroCob">Bairro</asp:Label>
<br />
<asp:TextBox runat="server" ID="dsBairroCob" Width="179px" TabIndex="29" />
</td>
<td class="auto-style25">
<asp:Label runat="server" AssociatedControlID="compEnderCob">Complemento</asp:Label>
<br />
<asp:TextBox runat="server" ID="compEnderCob" Width="194px" TabIndex="30" />
</td>
</tr>
</table>
<table>
<tr>
<td class="auto-style23">
<asp:Label runat="server" AssociatedControlID="dsCidCob">Cidade</asp:Label>
<br />
<asp:TextBox runat="server" ID="dsCidCob" Width="252px" TabIndex="31" />
</td>
<td class="auto-style27">
<asp:Label runat="server" AssociatedControlID="cdUFCob">UF</asp:Label>
<br />
<asp:TextBox runat="server" ID="cdUFCob" Width="33px" TabIndex="32" />
</td>
<td class="auto-style3">
<asp:Label runat="server" AssociatedControlID="foCliCob">Telefone</asp:Label>
<br />
<asp:TextBox runat="server" ID="foCliCob" Width="108px" TabIndex="33" />
</td>
<td class="auto-style19">
<asp:Label runat="server" AssociatedControlID="nrFaxCob">Fax</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="nrFaxCob" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nrFaxCob" Width="113px" TabIndex="34" />
</td>
</tr>
</table>
</div>
<br />
<div id="contatoCli" class="well" style="height: auto; width: auto;">
<table>
<tr>
<td class="auto-style70">
<asp:Label runat="server" AssociatedControlID="nmContat1">Comercial</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="nmContat1" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nmContat1" Width="396px" TabIndex="35" />
</td>
<td class="auto-style72">
<asp:Label runat="server" AssociatedControlID="foneCont1">Telefone</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="foneCont1" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="foneCont1" Width="122px" TabIndex="36" />
</td>
<td class="auto-style62">
<asp:Label runat="server" AssociatedControlID="dsEmail1" Width="46px">E-Mail</asp:Label>
<br />
<asp:TextBox runat="server" ID="dsEmail1" Width="343px" TabIndex="37" />
</td>
</tr>
<tr>
<td class="auto-style71">
<asp:Label runat="server" AssociatedControlID="nmContat2">Financeiro</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="nmContat2" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nmContat2" Width="396px" TabIndex="38" />
</td>
<td class="auto-style73">
<asp:Label runat="server" AssociatedControlID="foneCont2">Telefone</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="foneCont2" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="foneCont2" Width="122px" TabIndex="39" />
</td>
<td class="auto-style7">
<asp:Label runat="server" AssociatedControlID="dsEmail2">E-Mail</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="dsEmail2" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="dsEmail2" Width="343px" TabIndex="40" />
</td>
</tr>
<tr>
<td class="auto-style71">
<asp:Label runat="server" AssociatedControlID="nmContat3">Operacional</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="nmContat3" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nmContat3" Width="396px" TabIndex="41" />
</td>
<td class="auto-style73">
<asp:Label runat="server" AssociatedControlID="foneCont3" Width="66px">Telefone</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="foneCont3" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="foneCont3" Width="122px" TabIndex="42" />
</td>
<td class="auto-style7">
<asp:Label runat="server" AssociatedControlID="dsEmail3">E-Mail</asp:Label>
<br />
<asp:TextBox runat="server" ID="dsEmail3" Width="343px" TabIndex="43" />
</td>
</tr>
<tr>
<td class="auto-style71">
<asp:Label runat="server" AssociatedControlID="nmContat4">Expedição</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="nmContat4" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="nmContat4" Width="396px" TabIndex="44" />
</td>
<td class="auto-style73">
<asp:Label runat="server" AssociatedControlID="foneCont4">Telefone</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="foneCont4" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="foneCont4" Width="122px" TabIndex="45" />
</td>
<td class="auto-style7">
<asp:Label runat="server" AssociatedControlID="dsEmail4">E-Mail</asp:Label>
<asp:RequiredFieldValidator runat="server" ControlToValidate="dsEmail4" CssClass="field-validation-error" ErrorMessage="*" />
<br />
<asp:TextBox runat="server" ID="dsEmail4" Width="343px" TabIndex="46" />
</td>
</tr>
</table>
</div>
<br />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnCons" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
So, Here is the problem, I have a MasterPage which has the Header and the Footer of the page, and my children page is just the content, so, in this case, this form.
When I First click the button, it will work as planned, it will go on the database retrive my data and move to the textboxes ( texbox.Text = value; ).
But when I change the values, to do a second search the OnClick_Event its not fired, I have a breakpoint in the method so I can see it doesn't get there.
Also, with FireBug on I can see that when I click the button for the first time I get a "Refference Error: MyMethod is Not Defined" but it still brings my data and enters the method.
And when I click it for the second time I get the same Refference Error and I get a
"Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404"
as well
I'm really new at ASP.NET, I Have an understaining at JSF, But, this had to be done at ASP.NET Webforms
Thanks,
Gabriel
So, Sorry!! haha I feel so dumb for not noticing that earlier!!!
In the Reference Error (JS) it said /MyPage.aspx/MyMethod, but, for some reason i forgot that MyPage.aspx is inside a folder, I still don't quite understand why the second time it "forgot" the page directory, but, I took it of the folder and put it in the project main folder, and it fixed

collapsiblepanel collapse in code not collapsing

I have a panel that i have extended with collapsible extender. It is working perfectly until i try to collapse it by code.
The collapsible panel is shown inside a modal popup where user searches for some data, that is
shown in a grid , In every row of grid there is a select button that fires the row command event of the grid on which i am trying to close the panel.
Markup:
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAdd"
PopupControlID="pnlpopup" CancelControlID="Cancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="320px" Width="530px"
Style="display: none">
<table width="100%" style="border: Solid 3px #D55500; height: 100%" cellpadding="0"
cellspacing="0">
<tr>
<td>
Bridge ID :
<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvID" runat="server" ControlToValidate="txtID" ValidationGroup="vldAddBridge"
ErrorMessage="Please enter ID" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
Bridge Name :
<asp:TextBox ID="txtBridgeName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvBridgeName" runat="server" ControlToValidate="txtBridgeName"
ValidationGroup="vldAddBridge" ErrorMessage="Please enter bridge name." ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<td colspan="2" style="text-align: right; margin-left: 40px;">
<asp:Button ID="btnSearchUser" runat="server" OnClick="btnSearchUser_Click" TabIndex="5"
Text="Search" ValidationGroup="vgSearchMember" />
</td>
</tr>
<tr>
<td colspan="5" style="background-color: White" class="style6">
<asp:Label ID="lblSearchResults" runat="server"></asp:Label>
<asp:GridView ID="gvSearchResults" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderWidth="1px" CellPadding="4" CssClass="gridviewBorder"
DataKeyNames="EmpId" ForeColor="Black" GridLines="Horizontal" PageSize="5" RowStyle-CssClass="style5"
TabIndex="7" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
OnRowCommand="gvSearchResults_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" Text="Select" CommandName="Select"
CommandArgument='<%# Eval("EmpId") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EmpId" HeaderText="Employee ID" />
<asp:BoundField DataField="Alias" HeaderText="Username" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
</Columns>
</asp:GridView>
<br />
</td>
</tr>
</table>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" CollapseControlID="btnOwner"
ExpandControlID="btnOwner" TargetControlID="PnlRegister" Collapsed="true">
</asp:CollapsiblePanelExtender>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
<asp:Button ID="btnSaveBridge" runat="server" Text="Save" OnClick="btnSaveBridge_Click"
ValidationGroup="vldAddBridge" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
<span style="display: none">
<input type="button" id="Cancel" /></span>
</td>
</tr>
</table>
</asp:Panel>
Code:
protected void gvSearchResults_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
//some business logic
CollapsiblePanelExtender1.Collapsed = true;
ModalPopupExtender1.Show();
}
}
It is not working the panel is always open ?? Any suggestions.....
You are missing
tr in your design. Please check it
Markup:
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAdd"
PopupControlID="pnlpopup" CancelControlID="Cancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="320px" Width="530px"
Style="display: none">
<table width="100%" style="border: Solid 3px #D55500; height: 100%" cellpadding="0"
cellspacing="0">
<tr>
<td>
Bridge ID :
<asp:TextBox ID="txtID" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvID" runat="server" ControlToValidate="txtID" ValidationGroup="vldAddBridge"
ErrorMessage="Please enter ID" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
Bridge Name :
<asp:TextBox ID="txtBridgeName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvBridgeName" runat="server" ControlToValidate="txtBridgeName"
ValidationGroup="vldAddBridge" ErrorMessage="Please enter bridge name." ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
**<tr> //This is missing**
<td colspan="2" style="text-align: right; margin-left: 40px;">
<asp:Button ID="btnSearchUser" runat="server" OnClick="btnSearchUser_Click" TabIndex="5"
Text="Search" ValidationGroup="vgSearchMember" />
</td>
</tr>
<tr>
<td colspan="5" style="background-color: White" class="style6">
<asp:Label ID="lblSearchResults" runat="server"></asp:Label>
<asp:GridView ID="gvSearchResults" runat="server" AllowPaging="True" AutoGenerateColumns="False"
BackColor="White" BorderWidth="1px" CellPadding="4" CssClass="gridviewBorder"
DataKeyNames="EmpId" ForeColor="Black" GridLines="Horizontal" PageSize="5" RowStyle-CssClass="style5"
TabIndex="7" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
OnRowCommand="gvSearchResults_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" Text="Select" CommandName="Select"
CommandArgument='<%# Eval("EmpId") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="EmpId" HeaderText="Employee ID" />
<asp:BoundField DataField="Alias" HeaderText="Username" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
</Columns>
</asp:GridView>
<br />
</td>
</tr>
</table>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" CollapseControlID="btnOwner"
ExpandControlID="btnOwner" TargetControlID="PnlRegister" Collapsed="true">
</asp:CollapsiblePanelExtender>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
<asp:Button ID="btnSaveBridge" runat="server" Text="Save" OnClick="btnSaveBridge_Click"
ValidationGroup="vldAddBridge" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
<span style="display: none">
<input type="button" id="Cancel" /></span>
</td>
</tr>
</table>
</asp:Panel>
Hope it solve your problem

Modal Pop up is not displaying update panel in 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();
}
}

Resources