I have a modal inside an update panel which give information of student when click on argument in a grid view.
In my modal I have also 3 textbox in which the value need to be save when click in save button.
It is not triggering the save button.
Here is my code:
<div class="modal fade" id="studinfo" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Student Info</h4>
<button type="button" class="close"
data-dismiss="modal">
×</button>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="updModal" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<div class="card h-100">
<div class="card-body">
<ul class="list-group list-group-flush">
<asp:TextBox ID="txtId" Visible="false" runat="server"></asp:TextBox>
<asp:Panel ID="typepannel" CssClass="list-group-item" runat="server">
<asp:Label ID="lbltype" runat="server"
Font-Bold="true" Text="Candidate Type: "></asp:Label>
<asp:Label ID="type" runat="server"
Text=''>
</asp:Label>
</asp:Panel>
<asp:Panel ID="colpanel" CssClass="list-group-item" runat="server">
<asp:Label ID="lblCol" runat="server"
Font-Bold="true" Text="College Attend: "></asp:Label>
<asp:Label ID="college" runat="server"
Text=''>
</asp:Label>
</asp:Panel>
<div class="list-group-item">
<asp:Label ID="lblName" runat="server"
Font-Bold="true" Text="Name: "></asp:Label>
<asp:Label ID="Name" runat="server"
Text=''>
</asp:Label>
</div>
<div class="list-group-item">
<asp:Label ID="lblNic" runat="server"
Font-Bold="true" Text="Nic: "></asp:Label>
<asp:Label ID="Nic" runat="server"
Text=''>
</asp:Label>
</div>
<div class="list-group-item">
<asp:Label ID="lblAge" runat="server"
Font-Bold="true" Text="Age: "></asp:Label>
<asp:Label ID="Age" runat="server"
Text=''>
</asp:Label>
</div>
<div class="list-group-item">
<asp:Label ID="lblAdress" runat="server"
Font-Bold="true" Text="Address: "></asp:Label>
<asp:Label ID="Address" runat="server"
Text=''>
</asp:Label>
</div>
<div class="list-group-item">
<asp:Label ID="lblacad" runat="server"
Font-Bold="true" Text="Academy: "></asp:Label>
<asp:Label ID="Academy" runat="server"
Text=''>
</asp:Label>
</div>
<h6 class="mt-3 mb-3">Parent in Charge</h6>
<div class="list-group-item">
<asp:Label ID="lblParent" runat="server"
Font-Bold="true" Text="Parent Name: "></asp:Label>
<asp:Label ID="parentName" runat="server"
Text=''>
</asp:Label>
</div>
<div class="list-group-item">
<asp:Label ID="lblNumber" runat="server"
Font-Bold="true" Text="Parent Contact Number: "></asp:Label>
<asp:Label ID="Number" runat="server"
Text=''>
</asp:Label>
</div>
<div class="list-group-item">
<asp:Label ID="lblEmail" runat="server"
Font-Bold="true" Text="Parent Email Address: "></asp:Label>
<asp:Label ID="Email" runat="server"
Text=''>
</asp:Label>
</div>
<div class="list-group-item">
<asp:Label ID="lblResult" runat="server"
Font-Bold="true" Text="Result: "></asp:Label>
<asp:DropDownList ID="ddlResult"
CssClass="select form-control"
runat="server">
</asp:DropDownList>
</div>
<div class="list-group-item">
<asp:Label ID="lblMarks" runat="server" Font-Bold="true" Text="Marks: "></asp:Label>
<asp:TextBox runat="server" ID="txtMarks"
CssClass="form-control form-control-lg" />
<asp:RequiredFieldValidator ID="rfvMarks" runat="server"
Display="Dynamic" ForeColor="Red"
ControlToValidate="txtMarks"
SetFocusOnError="true"
ErrorMessage="Marks is Mandatory">
</asp:RequiredFieldValidator>
<asp:CompareValidator ID="cmpVMarks" runat="server"
ControlToValidate="txtMarks"
Operator="DataTypeCheck"
Type="Double"
SetFocusOnError="true"
Display="Dynamic"
Text="Incorect data type"
ForeColor="Red"
ErrorMessage="Invalid">
</asp:CompareValidator>
<asp:RegularExpressionValidator ID="revPhone"
runat="server"
ControlToValidate="txtMarks"
SetFocusOnError="true"
Display="Dynamic"
ForeColor="Red"
ValidationExpression="^\d\d+(\.[1-9])?$"
ErrorMessage="Invalid">
</asp:RegularExpressionValidator>
</div>
<div class="list-group-item">
<asp:Label ID="lblpurcentage" runat="server"
Font-Bold="true" Text="Purcentage : "></asp:Label>
<asp:TextBox runat="server" ID="txtpur"
CssClass="form-control form-control-lg" />
<asp:RequiredFieldValidator
ID="rfvpur" runat="server"
Display="Dynamic" ForeColor="Red"
ControlToValidate="txtpur"
SetFocusOnError="true"
ErrorMessage="Purcentage is Mandatory">
</asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvpur" runat="server"
ControlToValidate="txtpur"
Operator="DataTypeCheck"
Type="Double"
SetFocusOnError="true"
Display="Dynamic"
Text="Incorect data type"
ForeColor="Red"
ErrorMessage="Invalid">
</asp:CompareValidator>
</div>
</ul>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnSave" OnClick="btnSave_Click"
CssClass="btn btn-success btn-block" runat="server" Text="Save" />
</div>
</div>
To make this data appear in modal I used updModal.Update(); in the button where I use to call the modal.
Here is my code behind of save button:
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
string id = txtId.Text;
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update tblStudent set stud_result=#res,stud_purcentage=#pur,stud_totalMarks=#marks where stud_Id=#id";
cmd.Parameters.AddWithValue("#id", id);
cmd.Parameters.AddWithValue("#res", ddlResult.SelectedValue);
cmd.Parameters.AddWithValue("#pur", txtpur.Text.Trim());
cmd.Parameters.AddWithValue("#marks", txtMarks.Text.Trim());
con.Open();
cmd.Connection = con;
updModal.Update();
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this, GetType(), "LaunchServerSide",
"$(function () { showUErrorModal(); });", true);
}
finally
{
con.Close();
}
}
When I have try to put the button inside the update panel it freeze the app when I triger the button.
Can someone please please help me with that? Thank you in advance.
Related
I have a GridView in which I'm letting users edit previously generated estimates. Everything works fine till I hit recalculate button but after that, all the row values go haywire.
Below is a screenshot of the layout for your reference.
In that, All the details are being fetched from database and few of them are editable and after changing the values, below there is a refresh button which I'm using to recalculate. but my loop is causing them to calculate incorrectly. Please help me rectify my mistake.
below is my aspx code:
<div class="card-body">
<div class="row">
<div class="col-md-12">
<asp:GridView ID="grdPurchaseBill" runat="server" CssClass="table table-bordered table-responsive table-sm" AutoGenerateColumns="False" ShowFooter="false">
<Columns>
<asp:TemplateField HeaderText="Product" ItemStyle-Wrap="false" ControlStyle-Width="100%" ItemStyle-Width="100%">
<ItemTemplate>
<asp:TextBox ID="txtProduct" runat="server" CssClass="form-control form-control-sm" Width="100%" Style="width: 100%;" AutoCompleteType="Disabled" autocomplete="off" Text='<%# Eval("product") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Weight" ItemStyle-Wrap="false" HeaderStyle-Wrap="false">
<ItemTemplate>
<asp:TextBox ID="txtWeight" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("weight") %>' Width="100%" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="# of Bags" ItemStyle-Wrap="false" ControlStyle-Width="100%" HeaderStyle-Wrap="false">
<ItemTemplate>
<asp:TextBox ID="txtBags" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("bags") %>' Width="100%" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Shortage %" ItemStyle-Wrap="false" ControlStyle-Width="100%" HeaderStyle-Wrap="false">
<ItemTemplate>
<asp:TextBox ID="txtShortagePercent" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("shortage_percent") %>' Width="100%" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Shortage" ItemStyle-Wrap="false" ControlStyle-Width="100%" HeaderStyle-Wrap="false">
<ItemTemplate>
<asp:TextBox ID="txtShortage" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("shortage") %>' Width="100%" Style="width: 100%;" Enabled="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Net Weight" ItemStyle-Wrap="false" ControlStyle-Width="100%" HeaderStyle-Wrap="false">
<ItemTemplate>
<asp:TextBox ID="txtNetWeight" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("net_weight") %>' Width="100%" Style="width: 100%;" Enabled="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unit Price" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" ControlStyle-Width="100%">
<ItemTemplate>
<asp:TextBox ID="txtRate" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("rate") %>' Width="100%" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sub-Total" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" ControlStyle-Width="100%">
<ItemTemplate>
<asp:TextBox ID="txtSubTotal" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("sub_total") %>' Width="100%" Style="width: 100%;" Enabled="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Hamali %" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" ControlStyle-Width="100%">
<ItemTemplate>
<asp:TextBox ID="txtHamali" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("hamali_percent") %>' Width="100%" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Hamali Amt" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" ControlStyle-Width="100%">
<ItemTemplate>
<asp:TextBox ID="txtHamaliAmount" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("hamali") %>' Width="100%" Style="width: 100%;" Enabled="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Driver Comm. " ItemStyle-Wrap="false" HeaderStyle-Wrap="false" ControlStyle-Width="100%">
<ItemTemplate>
<asp:TextBox ID="txtDriverCommission" runat="server" CssClass="form-control form-control-sm" Text='<%# Eval("driver_commission") %>' Width="100%" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Net Amt" ItemStyle-Wrap="false" ControlStyle-Width="100%" HeaderStyle-Wrap="false">
<ItemTemplate>
<asp:TextBox ID="txtNetAmount" runat="server" CssClass="form-control form-control-sm" Enabled="false" Text='<%# Eval("net_amount") %>' Width="100%" Style="width: 100%;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Bill Date</label>
<div class="input-group margin input-group-sm">
<asp:TextBox ID="txtBDate" runat="server" CssClass="form-control form-control-sm" TabIndex="1" AutoCompleteType="Disabled" autocomplete="off"></asp:TextBox>
<ajax:CalendarExtender ID="ce1" runat="server" TargetControlID="txtBDate" Format="dd-MM-yyyy" />
<span class="input-group-btn">
<span class="fa fa-times"></span>
</span>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Name</label>
<div class="input-group input-group-sm">
<asp:TextBox ID="txtcname" runat="server" CssClass="form-control form-control-sm" TabIndex="2" CausesValidation="True" AutoCompleteType="Disabled" autocomplete="off"></asp:TextBox>
<asp:HiddenField ID="hfCustomerId" runat="server" />
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Phone</label>
<asp:TextBox ID="txtcmobile" runat="server" CssClass="form-control form-control-sm" TabIndex="3" AutoCompleteType="Disabled" autocomplete="off"></asp:TextBox>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Address</label>
<asp:TextBox ID="txtcaddress" runat="server" TextMode="MultiLine" TabIndex="6" CssClass="form-control form-control-sm"></asp:TextBox>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Lorry Freight</label>
<asp:TextBox ID="txtLorryFreight" runat="server" TabIndex="6" CssClass="form-control form-control-sm"></asp:TextBox>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Remarks</label>
<asp:TextBox ID="txtRemarks" runat="server" TabIndex="6" CssClass="form-control form-control-sm" TextMode="MultiLine"></asp:TextBox>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Total Amount</label>
<asp:Label ID="lblTotal" runat="server" CssClass="form-control form-control-sm lblTotal" Text="0" ForeColor="Blue" BackColor="#DEE2E6"></asp:Label>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Payable Amount</label>
<asp:Label ID="lblPayableAmt" runat="server" CssClass="form-control form-control-sm lblPayableAmt" Text="0" ForeColor="Blue" BackColor="#DEE2E6"></asp:Label>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Paid Amount</label>
<asp:TextBox ID="txtPaidAmt" runat="server" CssClass="form-control form-control-sm txtPaidAmt" OnTextChanged="CalculatePaidAmount" AutoPostBack="true" TabIndex="8" ForeColor="Blue" Text="0"></asp:TextBox>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Balance Amount</label>
<div class="input-group input-group-sm">
<label id="lblBalAmt" runat="server" class="form-control form-control-sm lblBalAmt" style="color: red; background-color: #DEE2E6;">0</label>
<span class="input-group-append">
<asp:LinkButton ID="lnkPayable" runat="server" OnClick="ReCalculate" CssClass="btn btn-outline-success btn-flat" Text="" TabIndex="9" CausesValidation="false"><i class="fa fa-sync"></i></asp:LinkButton>
</span>
</div>
</div>
</div>
</div>
</div>
And my aspx.cs code:
protected void GetBillDetails()
{
string query = "select * from estimates where bno='" + Request.QueryString["bno"].ToString() + "';";
grdPurchaseBill.DataSource = dal.GetData(query);
grdPurchaseBill.DataBind();
using (SqlConnection con = new SqlConnection(cm.constring))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(query, con))
{
using (SqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
txtBDate.Text = dr["bill_date"].ToString();
txtcname.Text = dr["name"].ToString();
txtcmobile.Text = dr["mobileno"].ToString();
txtcaddress.Text = dr["address"].ToString();
txtLorryFreight.Text = dr["lorry_freight"].ToString();
txtRemarks.Text = dr["remarks"].ToString();
lblTotal.Text = dr["grand_total"].ToString();
lblPayableAmt.Text = dr["payable_amount"].ToString();
txtPaidAmt.Text = dr["paid_amount"].ToString();
lblBalAmt.InnerText = dr["balance_amount"].ToString();
bno.InnerText = Request.QueryString["bno"].ToString();
}
}
}
con.Close();
}
}
protected void ReCalculate(object sender, EventArgs e)
{
decimal PayableAmount = 0, PaidAmount = !string.IsNullOrEmpty(txtPaidAmt.Text) ? Convert.ToDecimal(txtPaidAmt.Text) : 0, NetWeight = 0, SubTotal = 0, NetAmount = 0;
foreach (GridViewRow Row in grdPurchaseBill.Rows)
{
TextBox txtProduct = Row.FindControl("txtProduct") as TextBox;
TextBox txtWeight = Row.FindControl("txtWeight") as TextBox;
TextBox txtBags = Row.FindControl("txtBags") as TextBox;
TextBox txtShortagePercent = Row.FindControl("txtShortagePercent") as TextBox;
TextBox txtShortage = Row.FindControl("txtShortage") as TextBox;
TextBox txtNetWeight = Row.FindControl("txtNetWeight") as TextBox;
TextBox txtRate = Row.FindControl("txtRate") as TextBox;
TextBox txtSubTotal = Row.FindControl("txtSubTotal") as TextBox;
TextBox txtHamali = Row.FindControl("txtHamali") as TextBox;
TextBox txtHamaliAmount = Row.FindControl("txtHamaliAmount") as TextBox;
TextBox txtDriverCommission = Row.FindControl("txtDriverCommission") as TextBox;
TextBox txtNetAmount = Row.FindControl("txtNetAmount") as TextBox;
Control txtShortagePercent_ctrl = Row.FindControl("txtShortagePercent") as TextBox;
if (txtShortagePercent_ctrl != null)
{
txtShortage.Text = (Convert.ToDecimal(txtWeight.Text) - (Convert.ToDecimal(txtWeight.Text) - (Convert.ToDecimal(txtWeight.Text)) * (Convert.ToDecimal(txtShortage.Text) / 100))).ToString("#0.00");
//txtHamaliAmount.Text = (calculateHamali(Convert.ToDecimal(txtWeight.Text), Convert.ToDecimal(txtHamali.Text))).ToString("#0.00");
decimal TotalHamali = Convert.ToDecimal(txtHamali.Text) > 0 ? ((Convert.ToDecimal(txtWeight.Text) / 100) * Convert.ToDecimal(txtHamali.Text)) : 0;
NetAmount += ((Convert.ToDecimal(txtSubTotal.Text) - TotalHamali));// + Convert.ToDecimal(txtDriverCommission.Text)
txtNetAmount.Text = NetAmount.ToString("#0.00");
txtHamaliAmount.Text = TotalHamali.ToString("#0.00");
NetWeight += (Convert.ToDecimal(txtWeight.Text) - (Convert.ToDecimal(txtWeight.Text) * Convert.ToDecimal(txtShortage.Text) / 100));
txtNetWeight.Text = NetWeight.ToString("#0.00");
txtShortage.Text = (Convert.ToDecimal(txtWeight.Text) - (Convert.ToDecimal(txtWeight.Text) - (Convert.ToDecimal(txtWeight.Text) * Convert.ToDecimal(txtShortage.Text) / 100))).ToString();
SubTotal += (Convert.ToDecimal(txtNetWeight.Text) * Convert.ToDecimal(txtRate.Text));
txtSubTotal.Text = SubTotal.ToString("#0.00");
TextBox totamt = Row.FindControl("txtNetAmount") as TextBox;
PayableAmount += Convert.ToDecimal(!string.IsNullOrEmpty(totamt.Text) ? totamt.Text : "0");
}
}
lblTotal.Text = (PayableAmount).ToString("#0.00");
lblPayableAmt.Text = (PayableAmount - Convert.ToDecimal(!string.IsNullOrEmpty(txtLorryFreight.Text) ? txtLorryFreight.Text : "0")).ToString("#0.00");
lblBalAmt.InnerText = (PaidAmount > 0 ? Convert.ToDecimal(lblPayableAmt.Text) - PaidAmount : Convert.ToDecimal(lblPayableAmt.Text) - 0).ToString("#0.00");
}
I am facing a problem with below code. When I click on Repsendbtn it stores the same session value of UsrNme into both columns Receiver and Sender, where it is supposed to save session value into Receiver and into Sender the value of tolbl
<asp:FormView ID="repmsgform" runat="server" DataKeyNames="mailno" Width="100%" >
<ItemTemplate>
<div class="col-lg-12">
<form class="well span8">
<div class="row">
<div class="span3">
<label>From</label>
<asp:Label ID="tolbl" runat="server" CssClass="form-control" Text='<%# Bind("Receiver") %>'></asp:Label>
<label>To</label>
<asp:Label ID="frmlbl" runat="server" CssClass="form-control" Text='<%# Bind("sender") %>'></asp:Label>
<label>Ads Title</label>
<asp:Label ID="MsgTitLbl" runat="server" CssClass="form-control" Text='<%# Bind("Mestitle") %>'></asp:Label>
<asp:Label ID="adsnummsglbl" runat="server" Text='<%# Bind("AdsID") %>' Visible="false" ></asp:Label>
<asp:Label ID="mailnolbl" runat="server" Text='<%# Bind("mailno") %>' Visible="false" ></asp:Label>
</div>
<div class="span5">
<label>Message</label>
<asp:TextBox ID="TextBox15" runat="server" TextMode="MultiLine" Height="150px" CssClass="form-control"></asp:TextBox>
</textarea>
</div>
<asp:Label ID="msgsentlbl" runat="server" Font-Size="Medium" ForeColor="#669900"></asp:Label>
<asp:Button runat="server" ID="Repsendbtn" Text="Send" CssClass="btn btn-primary pull-right" OnCommand=" Repsendbtn_Command" CommandArgument='<%# Bind ("mailno") %>'/>
<asp:Button ID="Closebtn" runat="server" Text="Close" CssClass="btn btn-default pull-right" OnCommand=" Closebtn_Command" />
</div>
</form>
</div>
</ItemTemplate>
</asp:FormView>
Code:
protected void Repsendbtn_Command(object sender, CommandEventArgs e)
{
if (Session["UsrNme"] != null)
{
using (SqlConnection cn = new SqlConnection(sc))
{
string SendMsgSQL = #"INSERT INTO mails (AdsID, Mestitle, Message, Receiver, sender, Date) VALUES (#AdsID, #Mestitle, #Message, #Receiver, #sender, #Date)";
using (SqlCommand SendMsgcmd = new SqlCommand(SendMsgSQL, cn))
{
cn.Open();
var user = Session["UsrNme"];
SendMsgcmd.Parameters.AddWithValue("#Receiver", user);
SendMsgcmd.Parameters.AddWithValue("#Message", ((TextBox)repmsgform.FindControl("TextBox15")).Text);
SendMsgcmd.Parameters.AddWithValue("#Mestitle", ((Label)repmsgform.FindControl("MsgTitLbl")).Text);
SendMsgcmd.Parameters.AddWithValue("#AdsID", ((Label)repmsgform.FindControl("adsnummsglbl")).Text);
SendMsgcmd.Parameters.AddWithValue("#Date", DateTime.Now);
SendMsgcmd.Parameters.AddWithValue("#sender", ((Label)repmsgform.FindControl("tolbl")).Text);
SendMsgcmd.ExecuteNonQuery();
viewmsgView.Visible = true;
}
}
}
else
{
// Consider throwing an error (if these fields are required)
}
}
I am using 2 link buttons (Coordinator and Staff) which on_Click action displays corresponding panels asking for login/signup/forgotpassword. If the user select signup/forgotpassword a popup windows is popped (using ModalPopupExtender) asking for information. Everything worked fine unless and until I used required field validator within the panel which pops up when the user click on signup/forgotpassword. If I use required field validator my page run fine and when I click on any of the link button (Coordinator/Staff) nothing happens.
This is aspx code :
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type = "text/css">
.modalBackground
{
background-color: gray;
}
.modalPopup
{
background-color: white;
border-width: 3px;
border-style: solid;
border-color: black;
padding-top: 10px;
padding-left: 10px;
width: 300px;
height: 140px;
}
.panel
{
background : gray;
padding : 10px;
}
div ul ul
{
display: none;
}
div ul li:hover > ul
{
display: block;
}
div ul li ul:hover > ul
{
display: block;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="XX-Large" Text="Automated Examination System"></asp:Label><br /> <br /><br />
<asp:Panel ID = "MainPanel" runat = "server" Height="181px" Width="275px">
<ul>
<li style="margin-left: 33px; width: 169px;"> <asp:LinkButton ID = "LinkAdmin" runat = "server" onclick="LinkAdmin_Click">Coordinator</asp:LinkButton></li>
<li style="width: 172px; margin-left: 33px"> <asp:LinkButton ID="LinkStaff" runat="server" onclick="LinkStaff_Click">Staff</asp:LinkButton></li>
<li style="margin-left: 33px"> <asp:LinkButton ID = "LinkStudent" runat = "server">Student</asp:LinkButton>
<ul>
<li><asp:LinkButton ID = "LinkButton1" runat = "server">Fresh Registration</asp:LinkButton></li>
<li><asp:LinkButton ID = "LinkButton2" runat = "server">Re Registration</asp:LinkButton></li>
</ul>
</li>
</ul>
</asp:Panel>
<asp:Panel ID="InfoPanel" runat="server" style="left: 290px; top: 104px; position: absolute; height: 375px; width: 611px"><br /><br /><br />
<asp:Label ID="Label2" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="Medium" Text="The Automated Examination system will allow post graduation student and under graduation students to register their respective courses for their respective semester. "></asp:Label>
<asp:Label ID="Label3" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="Medium" Text="Once the registration process is completed for a student the system sends information to the controller of examination."></asp:Label><br />
<asp:Label ID="Label4" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="Medium" Text="Each staff will be able to enter the CIE1 and CIE2 marks based on the privileges provided by coordinator of that respective department. "></asp:Label><br />
<asp:Label ID="Label5" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="Medium" Text="Once the staff enters marks for CIE1/CIE2, they won’t be allowed to make changes later on. "></asp:Label><br />
<asp:Label ID="Label6" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="Medium" Text="After submitting the marks, the staff will be given with print out of the entered marks for further reference. "></asp:Label><br />
<asp:Label ID="Label7" runat="server" Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Size="Medium" Text="At the end of a semester each student SGPA is calculated and the controller take a back up copy of grade cards and result sheet of all the students. "></asp:Label><br />
<asp:Label ID="Label9" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="Medium" Text="Since student grades are sensitive information certain measures are taken to prevent unauthorized access. "></asp:Label><br />
<asp:Label ID="Label8" runat="server" Font-Bold="False" Font-Names="Arial" Font-Size="Medium" Text="The system also generate the transcript of student which contains all semester marks, Course Title in that particular semester, SGPA of each semester and overall CGPA of that student. "></asp:Label>
</asp:Panel>
<asp:Panel ID="AdminLogin" runat="server" style= "left: 906px; top: 105px; position: absolute; " Visible="False" Width="430px"><br/>
<asp:Label ID="Label10" runat="server" Text="Coordinator Login"></asp:Label><br /><br />
<asp:Label ID="Label11" runat="server" Text="Select Department : "></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" ValidationGroup="AdminLogin"></asp:DropDownList>
<asp:RequiredFieldValidator ID="AdminReq1" runat="server" ControlToValidate="DropDownList1" ErrorMessage="Department is blank" ForeColor="Red" ValidationGroup="AdminLogin"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label12" runat="server" Text="Select Branch : "></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" ValidationGroup="AdminLogin"></asp:DropDownList>
<asp:RequiredFieldValidator ID="AdminReq2" runat="server" ControlToValidate="DropDownList2" ErrorMessage="Branch is blank" ForeColor="Red" ValidationGroup="AdminLogin"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label13" runat="server" Text="Username : "></asp:Label>
<asp:TextBox ID="AdminTxt1" runat="server" ValidationGroup="AdminLogin" style="height: 22px"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdminReq3" runat="server" ControlToValidate="AdminTxt1" ErrorMessage="Username is blank" ForeColor="Red" ValidationGroup="AdminLogin"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label14" runat="server" Text="Password : "></asp:Label>
<asp:TextBox ID="AdminTxt2" runat="server" TextMode="Password" ValidationGroup="AdminLogin"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdminReq4" runat="server" ControlToValidate="AdminTxt2" ErrorMessage="Password is blank" ForeColor="Red" ValidationGroup="AdminLogin"></asp:RequiredFieldValidator><br /><br />
<asp:Button ID="AdminLog" runat="server" Text="Login" Width="80px" ValidationGroup="AdminLogin" />
<asp:Button ID="AdminSignUp" runat="server" Text="New Coordinator" Width="110px"/>
<asp:Button ID="AdminForPwd" runat="server" Text="Forgot Password" />
</asp:Panel>
<asp:Panel ID="StaffLogin" runat="server" style="left: 906px; top: 105px; position: absolute;" Visible="False" Width="430px"><br />
<asp:Label ID="Label15" runat="server" Text="Staff Login"></asp:Label><br /><br />
<asp:Label ID="Label16" runat="server" Text="Username : "></asp:Label>
<asp:TextBox ID="StaffTxt1" runat="server" Width="127px" ValidationGroup="StaffLogin"></asp:TextBox>
<asp:RequiredFieldValidator ID="StaffReq1" runat="server" ControlToValidate=" StaffTxt1" ErrorMessage="Username is blank" ForeColor="Red" ValidationGroup="StaffLogin"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label17" runat="server" Text="Password : "></asp:Label>
<asp:TextBox ID="StaffTxt2" runat="server" TextMode="Password" ValidationGroup="StaffLogin"></asp:TextBox>
<asp:RequiredFieldValidator ID="StaffReq2" runat="server" ControlToValidate=" StaffTxt2" ErrorMessage="Password is blank" ForeColor="Red" ValidationGroup="StaffLogin"></asp:RequiredFieldValidator><br /><br />
<asp:Button ID="StaffLog" runat="server" Text="Login" Width="80px" ValidationGroup="StaffLogin" />
<asp:Button ID="StaffSignUp" runat="server" Text="New Staff" Width="82px"/>
<asp:Button ID="StaffForPwd" runat="server" Text="Forgot Password" Width="110px" />
</asp:Panel>
<asp:Panel ID="StaffSP" CssClass="modalPopup" style="display: none" runat="server">
<asp:Label ID="Label18" runat="server" Text="Staff Sign Up" Font-Size="XX-Large"></asp:Label><br /><br />
<asp:Label ID="Label19" runat="server" Text="Enter Course Code : "></asp:Label>
<asp:TextBox ID="StaffSPTxt1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="StaffSPReq1" runat="server" ErrorMessage="Course Code is BLANK" ForeColor="Red" ControlToValidate="StaffSPTxt1"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label20" runat="server" Text="Enter Password : "></asp:Label>
<asp:TextBox ID="StaffSPTxt2" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="StaffSPReq2" runat="server" ErrorMessage="Password is BLANK" ForeColor="Red" ControlToValidate="StaffSPTxt2"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label21" runat="server" Text="Retype Password : "></asp:Label>
<asp:TextBox ID="StaffSPTxt3" runat="server" TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="StaffSPCom1" runat="server" ErrorMessage="Password Mismatch" ForeColor="Red" ControlToCompare="StaffSPTxt2" ControlToValidate="StaffSPTxt3"></asp:CompareValidator><br /><br />
<asp:Label ID="Label22" runat="server" Text="Enter Password Hint : "></asp:Label>
<asp:TextBox ID="StaffSPTxt4" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="StaffSPReq3" runat="server" ErrorMessage="Password Hint is BLANK" ForeColor="Red" ControlToValidate="StaffSPTxt4"></asp:RequiredFieldValidator><br /><br />
<asp:Button ID="Button3" runat="server" Text="Sign Up" />
<asp:Button ID="Button4" runat="server" Text="Cancel" />
</asp:Panel>
<asp:Panel ID="StaffFP" CssClass="modalPopup" style="display: none" runat="server">
<asp:Label ID="Label23" runat="server" Text="Staff Forgot Password" Font-Size="XX-Large"></asp:Label><br /><br />
<asp:Label ID="Label24" runat="server" Text="Enter Username : "></asp:Label>
<asp:TextBox ID="StaffFPTxt1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="StaffFPReq1" runat="server" ErrorMessage="Username is BLANK" ForeColor="Red" ControlToValidate="StaffFPTxt1"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label25" runat="server" Text="Enter Password Hint : "></asp:Label>
<asp:TextBox ID="StaffFPTxt2" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="StaffFPReq2" runat="server" ErrorMessage="Hint is BLANK" ForeColor="Red" ControlToValidate="StaffFPTxt2"></asp:RequiredFieldValidator><br /><br />
<asp:Button ID="Button5" runat="server" Text="GetPassword" />
<asp:Button ID="Button6" runat="server" Text="Cancel" />
</asp:Panel>
<asp:Panel ID="AdminSP" CssClass="modalPopup" style="display: none" runat="server">
<asp:Label ID="Label26" runat="server" Text="Coordinator Sign Up" Font-Size="XX-Large"></asp:Label><br /><br />
<asp:Label ID="Label27" runat="server" Text="Select Department : "></asp:Label>
<asp:DropDownList ID="AdminSPDrp1" runat="server" ></asp:DropDownList>
<asp:RequiredFieldValidator ID="AdminSPReq1" runat="server" ErrorMessage="Department is BLANK" ForeColor="Red" ControlToValidate="AdminSPDrp1"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label28" runat="server" Text="Select Branch : "></asp:Label>
<asp:DropDownList ID="AdminSPDrp2" runat="server" ></asp:DropDownList>
<asp:RequiredFieldValidator ID="AdminSPReq2" runat="server" ErrorMessage="Branch is BLANK" ForeColor="Red" ControlToValidate="AdminSPDrp2"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label29" runat="server" Text="Enter Username : "></asp:Label>
<asp:TextBox ID="AdminSPTxt1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdminSPReq3" runat="server" ErrorMessage="Username is BLANK" ForeColor="Red" ControlToValidate="AdminSPTxt1"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label30" runat="server" Text="Enter Password : "></asp:Label>
<asp:TextBox ID="AdminSPTxt2" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdminSPReq4" runat="server" ErrorMessage="Password is BLANK" ForeColor="Red" ControlToValidate="AdminSPTxt2"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label31" runat="server" Text="Retype Password : "></asp:Label>
<asp:TextBox ID="AdminSPTxt3" runat="server" TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="AdminSPCom1" runat="server" ControlToValidate = "AdminSPTxt3" ControlToCompare = "AdminSPTxt2" ErrorMessage="Password Mismatch" ForeColor="Red"></asp:CompareValidator><br /><br />
<asp:Label ID="Label32" runat="server" Text="Enter Password Hint : "></asp:Label>
<asp:TextBox ID="AdminSPTxt4" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdminSPReq5" runat="server" ErrorMessage="Hint is BLANK" ForeColor="Red" ControlToValidate="AdminSPTxt4"></asp:RequiredFieldValidator><br /><br />
<asp:Button ID="Button7" runat="server" Text="Sign Up" />
<asp:Button ID="Button8" runat="server" Text="Cancel" />
</asp:Panel>
<asp:Panel ID="AdminFP" CssClass="modalPopup" style="display: none" runat="server">
<asp:Label ID="Label33" runat="server" Text="Coordinator Forgot Password" Font-Size="XX-Large"></asp:Label><br /><br />
<asp:Label ID="Label34" runat="server" Text="Select Department : "></asp:Label>
<asp:DropDownList ID="AdminFPDrp1" runat="server" ></asp:DropDownList>
<asp:RequiredFieldValidator ID="AdminFPReq1" runat="server" ErrorMessage="Department is BLANK" ForeColor="Red" ControlToValidate="AdminFPDrp1"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label35" runat="server" Text="Select Branch : "></asp:Label>
<asp:DropDownList ID="AdminFPDrp2" runat="server" ></asp:DropDownList>
<asp:RequiredFieldValidator ID="AdminFPReq2" runat="server" ErrorMessage="Branch is BLANK" ForeColor="Red" ControlToValidate="AdminFPDrp2"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label36" runat="server" Text="Enter Username : "></asp:Label>
<asp:TextBox ID="AdminFPTxt1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdminFPReq3" runat="server" ErrorMessage="Username is BLANK" ForeColor="Red" ControlToValidate="AdminFPTxt1"></asp:RequiredFieldValidator><br /><br />
<asp:Label ID="Label37" runat="server" Text="Enter Password Hint : "></asp:Label>
<asp:TextBox ID="AdminFPTxt2" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdminFPReq4" runat="server" ErrorMessage="Hint is BLANK" ForeColor="Red" ControlToValidate="AdminFPTxt2"></asp:RequiredFieldValidator><br /><br />
<asp:Button ID="Button9" runat="server" Text="Sign Up" />
<asp:Button ID="Button10" runat="server" Text="Cancel" />
</asp:Panel>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="modalBackground" PopupControlID = "StaffSP" CancelControlID = "Button4" TargetControlID = "StaffSignUp" runat="server"></asp:ModalPopupExtender>
<asp:ModalPopupExtender ID="ModalPopupExtender2" BackgroundCssClass="modalBackground" PopupControlID = "StaffFP" CancelControlID = "Button6" TargetControlID = "StaffForPwd" runat="server"></asp:ModalPopupExtender>
<asp:ModalPopupExtender ID="ModalPopupExtender3" BackgroundCssClass="modalBackground" PopupControlID = "AdminSP" CancelControlID = "Button8" TargetControlID = "AdminSignUp" runat="server"></asp:ModalPopupExtender>
<asp:ModalPopupExtender ID="ModalPopupExtender4" BackgroundCssClass="modalBackground" PopupControlID = "AdminFP" CancelControlID = "Button10" TargetControlID = "AdminForPwd" runat="server"></asp:ModalPopupExtender>
</div>
</form>
</body>
</html>
This is code behind page :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MasterFinal : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void LinkAdmin_Click(object sender, EventArgs e)
{
AdminLogin.Visible = true;
StaffLogin.Visible = false;
}
protected void LinkStaff_Click(object sender, EventArgs e)
{
AdminLogin.Visible = false;
StaffLogin.Visible = true;
}
}
i have made registeration form, forgot password and login form in a single aspx page . I am using css to style the whole form. I am using 3 form tags. Here is code:
ASMX
<form id="form1" runat="server" visible="true">
<ul>
<li>
<asp:TextBox ID="email" runat="server" TextMode="email" placeholder="Email" OnTextChanged="email_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="email" Display="Dynamic" ErrorMessage="RequiredFieldValidator">*Requied</asp:RequiredFieldValidator>
</li>
<li>
<asp:TextBox ID="password" runat="server" TextMode="Password" placeholder="Password" OnTextChanged="password_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="password" Display="Dynamic" ErrorMessage="RequiredFieldValidator">*Requied</asp:RequiredFieldValidator>
</li>
<li>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</li>
<li>
<asp:Label ID="Invalid" runat="server" Text="Invalid Username or Password" Visible="False" ></asp:Label>
<asp:Label ID="Try" runat="server" Text="You can't try again ,Register Your Self" Visible="False"></asp:Label>
</li>
</ul>
</form>
<form runat="server" id="form2" visible="false">
<ul>
<li>
<asp:TextBox ID="username" runat="server" MaxLength="15" placeholder="UserName" OnTextChanged="username_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="username" ErrorMessage="RequiredFieldValidator" ForeColor="Red">*Please Input user name</asp:RequiredFieldValidator>
<asp:Label ID="userchk" runat="server" ForeColor="Red"></asp:Label>
</li>
<li>
<asp:TextBox ID="EmailR" runat="server" placeholder="Email (must be valid)" OnTextChanged="EmailR_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="EmailR" ErrorMessage="RequiredFieldValidator" ForeColor="Red">*Please Input email</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="EmailR" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="RegularExpressionValidator" ForeColor="Red">Input Valid Email</asp:RegularExpressionValidator>
</li>
<li>
<asp:TextBox ID="FirstName" runat="server" placeholder="FirstName" MaxLength="15" OnTextChanged="FirstName_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="FirstName" ErrorMessage="RequiredFieldValidator" ForeColor="Red">*Please Input first name</asp:RequiredFieldValidator>
<asp:Label ID="chkemail" runat="server" ForeColor="Red"></asp:Label>
</li>
<li>
<asp:TextBox ID="LastName" runat="server" placeholder="Lastname" MaxLength="15" OnTextChanged="TextBox3_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="LastName" ErrorMessage="RequiredFieldValidator" ForeColor="Red">*Please Input Last name</asp:RequiredFieldValidator>
</li>
<li>
<asp:TextBox ID="Pass" runat="server" placeholder="Password" TextMode="Password" MaxLength="15" OnTextChanged="Pass_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="Pass" Display="Dynamic" ErrorMessage="RequiredFieldValidator" ForeColor="Red">*Please Input password</asp:RequiredFieldValidator>
</li>
<li>
<asp:TextBox ID="Cpass" runat="server" placeholder="Confirm Password" TextMode="Password" MaxLength="15" OnTextChanged="Cpass_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="Cpass" ErrorMessage="RequiredFieldValidator" ForeColor="Red">*Please Enter the Confirm Password </asp:RequiredFieldValidator>
</ul>
</form>
<form runat="server" visible="false" id="form3">
<ul>
<li>
<asp:TextBox ID="SendEmail" runat="server" TextMode="Email" placeholder="Enter Email" OnTextChanged="SendEmail_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="SendEmail" Display="Dynamic" ErrorMessage="RequiredFieldValidator">*Requied</asp:RequiredFieldValidator>
</li>
<li>
<asp:Button runat="server" text="Send email" OnClick="SendMail_Click" CssClass="button" Visible="true" CausesValidation="False"/>
</li>
<li>
<asp:Label ID="ml" runat="server" Text="Email sended Sucessfully" Visible="False"></asp:Label>
<asp:Label ID="ml0" runat="server" Text="Email Didn't Match " Visible="False"></asp:Label>
</li>
</ul>
</form>
I used following Js in toglling categories:
JS
<script>
$(document).ready(function () {
$("#list1").click(function () {
$("#form1").fadeIn("slow");
$("#form2").css("display", "none");
$("#form3").css("display", "none");
});
$("#list2").click(function () {
$("#form2").fadeIn("slow");
$("#form2").css("visible", "true");
$("#form1").css("display", "none");
$("#form3").css("display", "none");
});
$("#list3").click(function () {
$("#form3").fadeIn("slow");
$("#form3").css("visible", "true");
$("#form2").css("display", "none");
$("#form1").css("display", "none");
});
});
</script>
and here is my css FORMS
I have to use multiple forms in any case .. can anyone help please??
I have a page where I am using 3 update panels and all the update panels are working well. In one of the update panels, I have a button which on click changes label text but the problem is that on if post back happens in any of the update panels file upload loses its file.
All the update panels are used to update separate sections of page. No update panel is nested. The file upload is outside; it is not in any of the update panels but it is still losing its file.
<%# Control Language="C#" AutoEventWireup="true" CodeFile="WalkInControl.ascx.cs"
Inherits="Modules_WalkInControl" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
<asp:Panel ID="Panel1" runat="server" Font-Size="13px" Width="670">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers ="true" UpdateMode="Conditional">
<ContentTemplate>
<div class="formfieldset" style="margin-bottom: 40px;">
<div class="formrow">
<div class="paymentfrmlabels">
Check In :</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtCheckIn" runat="server" Width="153px"></asp:TextBox>
<asp:ImageButton ID="imgbtnCalendar1" runat="server" ImageUrl="~/App_Themes/Default/images/ico-calendar.gif"
CausesValidation="false" Width="20" Height="20" />
<ajaxtoolkit:CalendarExtender ID="CalendarExtender2" runat="server" Format="dd/MM/yyyy"
TargetControlID="txtCheckIn" PopupButtonID="imgbtnCalendar1" />
</div>
<div class="paymentfrmvalidation">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="[*]"
ControlToValidate="txtCheckIn" Display="Dynamic" ValidationGroup="a"></asp:RequiredFieldValidator>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Check Out:
</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtCheckOut" runat="server" Width="153px"></asp:TextBox>
<asp:ImageButton ID="imgbtnCalendar" runat="server" ImageUrl="~/App_Themes/Default/images/ico-calendar.gif"
CausesValidation="false" ImageAlign="Top" Width="20" Height="20" />
<ajaxtoolkit:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yyyy"
TargetControlID="txtCheckOut" PopupButtonID="imgbtnCalendar" />
</div>
<div class="paymentfrmvalidation">
<asp:RequiredFieldValidator ID="valStartDate" runat="server" ErrorMessage="[*]" ControlToValidate="txtCheckOut"
Display="Dynamic" ValidationGroup="a"></asp:RequiredFieldValidator>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Room Type :
</div>
<div class="paymentfrmtxtbox">
<asp:DropDownList ID="drpRoomtype" runat="server" Width="172px" AutoPostBack="True"
OnSelectedIndexChanged="drpRoomtype_SelectedIndexChanged" AppendDataBoundItems="True">
</asp:DropDownList>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Plan :
</div>
<div class="paymentfrmtxtbox" style="height: 25px;">
<asp:DropDownList ID="drpPlan" Width="172px" AutoPostBack="True"
runat="server" onselectedindexchanged="drpPlan_SelectedIndexChanged1">
</asp:DropDownList>
</div>
</div>
<div class="formrow" style="height: 75px;">
<div class="paymentfrmlabels">
Room :
</div>
<div class="paymentfrmtxtbox">
<asp:ListBox ID="lstRooms" runat="server" Width="172px" SelectionMode="Multiple">
</asp:ListBox>
</div>
<div class="paymentfrmvalidation">
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="lstRooms"
ErrorMessage="[*]" ValidationGroup="b"></asp:RequiredFieldValidator>
</div>
<div class="paymentfrmvalidation">
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img src="../Images/loading_sm.gif" border="0" alt="">
</ProgressTemplate>
</asp:UpdateProgress>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="drpRoomtype"
ErrorMessage="[*]" ValidationGroup="a"></asp:RequiredFieldValidator>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Adults :
</div>
<div class="paymentfrmtxtbox" style="width: 50px; height: 25px;">
<asp:DropDownList ID="drpAdults" Width="50px" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="drpAdults_SelectedIndexChanged" AppendDataBoundItems="True">
</asp:DropDownList>
</div>
<div class="paymentfrmlabels" style="width: 65px;">
Children :
</div>
<div class="paymentfrmtxtbox" style="width: 50px; height: 25px;">
<asp:DropDownList ID="drpChildren" Width="50px" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="drpChildren_SelectedIndexChanged">
</asp:DropDownList>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Rate :</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtRate" Width="153px" runat="server"></asp:TextBox>
</div>
<div class="paymentfrmvalidation">
<%--<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtRate"
ErrorMessage="Invalid Format" ValidationExpression="^(-)?\d+(\.\d\d)?$" ValidationGroup="a"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtRate"
ErrorMessage="Rate Required" ValidationGroup="a"></asp:RequiredFieldValidator></div>--%>
</div>
</div> <div align="center"> <asp:Label ID="lblRoomMsg" runat="server" ForeColor="Red"></asp:Label></div>
<div class="formrow">
<div class="paymentfrmlabels">
Advance Pay:
</div>
<div class="paymentfrmtxtbox" style="height: 25px;">
<asp:TextBox ID="txtAdvance" runat="server" Width="153px">0.0</asp:TextBox>
</div>
</div>
<div class="formrow" style="text-align: right;">
<asp:LinkButton ID="lnkAdd" CssClass="btn" runat="server" Width="60px" OnClick="lnkAdd_Click1">ADD</asp:LinkButton>
</div>
<div class="formrow" style="text-align:center;">
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtCheckOut"
ControlToValidate="txtCheckIn" Operator="LessThanEqual" Type="Date" ForeColor="Red" ErrorMessage="CheckIn Must Be Before CheckOut"
Display="Dynamic" ValidationGroup="a"/>
</div>
<div class="formrow" style="height: auto; margin-top: 20px; width: 430px;">
<asp:GridView ID="gvAddedRooms" runat="server" CssClass="active-grid" AutoGenerateColumns="False"
DataKeyNames="ID" Height="18px" Width="100%" OnRowDeleting="gvAddedRooms_RowDeleting">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" />
<asp:BoundField DataField="RoomTypeX" HeaderText="RoomType" />
<asp:BoundField DataField="RoomX" HeaderText="RoomX" />
<asp:BoundField DataField="Rate" HeaderText="Rate" DataFormatString="{0:f}" />
<asp:BoundField DataField="Adults" HeaderText="Adults" />
<asp:BoundField DataField="Children" HeaderText="Children" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
</div>
<div style="float:left;"> <asp:Label ID="Label1" runat="server" Text="Total Charge : " Font-Bold="true" ForeColor ="Blue" style="font-size:19px;"></asp:Label><asp:Label ID="lblTotalAmount" runat="server" Text=""></asp:Label>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="gvAddedRooms" />
<asp:PostBackTrigger ControlID="drpRoomtype" />
<asp:PostBackTrigger ControlID="drpPlan" />
<asp:PostBackTrigger ControlID="lnkAdd" />
<asp:PostBackTrigger ControlID="lstRooms" />
<asp:PostBackTrigger ControlID="drpAdults" />
<asp:PostBackTrigger ControlID="drpChildren" />
<asp:PostBackTrigger ControlID="btnRemoveFilename1" />
</Triggers>
</asp:UpdatePanel>
<%--<div class="formrow" style="text-align: right;">
<asp:UpdatePanel ID="UpdatePanel3" UpdateMode ="Conditional" runat="server">
<ContentTemplate >
Agency :
<asp:DropDownList ID="drpChannel" runat="server" Width="172px" AutoPostBack="True"
Height="32px" >
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="drpChannel"
/>
<asp:AsyncPostBackTrigger ControlID="lnkNewChannel" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="lnkNewChannel" runat="server" >New Channel</asp:LinkButton>
</div> --%>
<div class="newsubheadingsearchqueryresults" style="width: 685px;">
<h3>
Customer Details</h3>
<span class="requiredExample">[ * ] = Required Information</span></div>
<div class="formfieldset" style="margin-bottom: 40px;">
<div class="formrow">
<div class="paymentfrmlabels">
Paying Customer :</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtCustomerName" Width="153px" runat="server"></asp:TextBox>
</div>
<div class="paymentfrmvalidation">
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtCustomerName"
ErrorMessage="[*]" ValidationExpression="^[a-zA-Z''-'\s]{1,40}$"
ValidationGroup="a" Display="Dynamic"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtCustomerName"
ValidationGroup="a" ErrorMessage="[*]" Display="Dynamic"></asp:RequiredFieldValidator>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Customer Type :</div>
<div class="paymentfrmtxtbox">
<asp:DropDownList ID="drpCustomerType" Width="153px" runat="server">
<asp:ListItem Text="Person" Value="Person"></asp:ListItem>
<asp:ListItem Text="Company" Value="Company"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
E-Mail :
</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtEmail" Width="153px" runat="server"></asp:TextBox>
</div>
<div class="paymentfrmvalidation">
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Phone No :
</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtPhone" runat="server" Height="23px" Width="153px"></asp:TextBox>
</div>
<div class="paymentfrmvalidation">
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ErrorMessage="Invalid format"
Display="Dynamic" ValidationExpression="^[0-9]*$" ControlToValidate="txtPhone"
ValidationGroup="a"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtPhone"
Display="Dynamic" ValidationGroup="a" ErrorMessage="[*]"></asp:RequiredFieldValidator>
</div>
</div>
<div class="formrow" style="height: 130px;">
<div class="paymentfrmlabels">
Address:</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtAddress" runat="server" Height="129px" TextMode="MultiLine" Width="153px"></asp:TextBox>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
City :</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtCity" runat="server" Width="153px"></asp:TextBox>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Country :</div>
<div class="paymentfrmtxtbox">
<asp:DropDownList ID="drpCountry" Width="153px" runat="server">
</asp:DropDownList>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
State :</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtState" Width="153px" runat="server"></asp:TextBox>
</div>
</div>
<div class="formrow">
<div class="paymentfrmlabels">
Postal Code :</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtPostalCode" Width="153px" runat="server"></asp:TextBox>
</div>
</div>
<div class="formrow" style="height: 90px; width: 670px;">
<div class="paymentfrmlabels">
Other Guest Names :</div>
<div class="paymentfrmtxtbox" style="margin-right:45px;">
<asp:TextBox ID="txtOtherGuest" runat="server" Height="90px" Width="153px" TextMode="MultiLine"></asp:TextBox>
</div>
<div class="paymentfrmlabels">
Other Information:</div>
<div class="paymentfrmtxtbox">
<asp:TextBox ID="txtOtherInf" runat="server" Height="90px" Width="153px" TextMode="MultiLine"></asp:TextBox>
</div>
</div>
<div class="formrow" style="vertical-align: text-top;">
<div class="paymentfrmlabels">
Identity Proof :</div>
</div>
<div class="formrow">
<div class="paymentfrmtxtbox">
</div>
</div>
<div class="formrow" style="text-align: right">
<div class="paymentfrmlabels">
<input id="txtLogoFileName1" type="file" style ="float :left; z-index:999;" name="txtSmallImage1FileName" runat="server" />
<asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers ="true" UpdateMode ="Conditional">
<ContentTemplate >
<div class="paymentfrmtxtbox">
<asp:Button ID="btnRemoveFilename1" runat="server" style="margin-left:50px; float :left; z-index:999;" Text="Remove" OnClick="btnRemoveFilename1_Click">
</asp:Button>
</div>
<asp:Label ID="lblLogoFileName1" runat="server" CssClass="labelText" ForeColor="Silver"> </asp:Label>
</div>
</ContentTemplate>
<Triggers >
<asp:PostBackTrigger ControlID ="btnRemoveFilename1" />
</Triggers>
</asp:UpdatePanel>
<div class="formrow" style="width: 300px;">
<div class="paymentfrmtxtbox ">
<asp:UpdatePanel ID="UpdatePanel3" UpdateMode ="Conditional" ChildrenAsTriggers ="true" runat="server">
<ContentTemplate >
Agency:
<asp:DropDownList ID="drpChannel" runat="server" Width="153px" AutoPostBack="True"
style=" float: right; height: 28px; margin-right: 65px;width: 157px;" >
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="drpChannel"
/>
<asp:AsyncPostBackTrigger ControlID="lnkNewChannel" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="lnkNewChannel" runat="server" style="display:block; float: right;margin-right: -71px; margin-top: 16px;" >New Channel</asp:LinkButton>
</div>
</div>
</div>
<div class="formrow" style="text-align: right; font-weight:bold; color:#000;">
</div>
<div class="formrow" style="text-align: right; width: 670px;">
<asp:LinkButton ID="lnkSubmit" CssClass="btn" runat="server" OnClick="lnkSubmit_Click1"
Width="65px" ValidationGroup="a">Check In</asp:LinkButton>
<asp:LinkButton ID="lnkCheckout" CssClass="btn" Width="65px" runat="server" OnClick="lnkCheckout_Click"
ValidationGroup="a">Check Out</asp:LinkButton>
<asp:LinkButton ID="lnkCancel" CssClass="btn" Width="65px" runat="server" OnClick="lnkCancel_Click1">Cancel</asp:LinkButton>
</div>
</div>
</div>
<ajaxtoolkit:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="modalBackground" PopupControlID ="pnlChannel" TargetControlID ="lnkNewChannel" CancelControlID ="ImgBtnClose" runat="server">
</ajaxtoolkit:ModalPopupExtender>
<asp:Panel ID="pnlChannel" runat="server">
<div align="right" style ="padding-top :50px" >
<asp:ImageButton ID="ImgBtnClose" width="25px" Height ="25px" ImageUrl="~/Images/cross.png" runat="server" /></div>
<div style ="background-color:White ; border :20px; border-color:Blue;padding:20px 40px; border-radius:20px;" >
<style type="text/css">
.style1 {
width: 100%;
}
.style2
{
text-align: center;
font-weight: bold;
font-family: Andalus;
font-size: xx-large;
color: #434343;
}
.style3
{
width: 81px;
}
</style>
<div>
<table class="style1">
<tr>
<td class="style2" colspan="2">
Agency</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr><td> </td><td> </td></tr>
<tr>
<td class="style3">
<asp:Label ID="lblName" runat="server" Text="Name:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtName" runat="server" Width="189px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="txtName" Display="Dynamic" ErrorMessage="Mandatory Field!!!"
ForeColor="Red" ValidationGroup="acssd23"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server"
ControlToValidate="txtName" Display="Dynamic"
ErrorMessage="Invalid Name Format!!!" Font-Names="Arial" Font-Size="8pt"
ForeColor="Red" SetFocusOnError="True"
ValidationExpression="^[a-zA-Z-'.\s]{1,50}" ValidationGroup="acssd23"></asp:RegularExpressionValidator>
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr>
<td class="style3">
<asp:Label ID="lblContact" runat="server" Text="Contact:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtContact" runat="server" Width="189px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ControlToValidate="txtContact" Display="Dynamic"
ErrorMessage="Mandatory Field!!!" ForeColor="Red"
ValidationGroup="acssd23"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="txtContact" Display="Dynamic"
ErrorMessage="Invalid Contact Format!!!" ForeColor="Red"
style="font-size: xx-small" ValidationExpression="^[0-9-+]*$"
ValidationGroup="acssd23"></asp:RegularExpressionValidator>
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr>
<td class="style3">
<asp:Label ID="lblAddress" runat="server" Text="Address:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtAddresss" runat="server" Height="64px" TextMode="MultiLine"
width="189px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server"
ControlToValidate="txtAddresss" Display="Dynamic"
ErrorMessage="Mandatory Field!!!" ForeColor="Red"
ValidationGroup="acssd23"></asp:RequiredFieldValidator>
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr>
<td class="style3">
<asp:Label ID="lblEmail" runat="server" Text="Email:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtEmails" runat="server" Width="189px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
ControlToValidate="txtEmails" Display="Dynamic"
ErrorMessage="Mandatory Field!!!" ForeColor="Red"
ValidationGroup="acssd23"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator015" runat="server"
ControlToValidate="txtEmail" ErrorMessage="Invalid Email Format!!!"
ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*"
ValidationGroup="acssd23"></asp:RegularExpressionValidator>
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr>
<td class="style3">
<asp:Label ID="lblWebsite" runat="server" Text="Website:"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtWebsite" runat="server" Width="189px"></asp:TextBox>
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr>
<td class="style3">
</td>
<td>
</td>
</tr>
<tr>
<td class="style3">
</td>
<td align ="right" >
<asp:Button ID="btnSubmit" CssClass="btn" Width ="140px" runat="server" Text="Submit"
onclick="btnSubmit_Click" style="height: 26px" ValidationGroup="acssd23" />
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
</asp:Panel>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional">
<Triggers>
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server"Text="Upload" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
The default ASP.NET FileUpload control will never work with an UpdatePanel. You need a special AsyncFileUpload control as defined in an AjaxControl Toolkit.
<ajaxToolkit:AsyncFileUpload OnClientUploadError="uploadError"
OnClientUploadComplete="uploadComplete" runat="server"
ID="AsyncFileUpload1" Width="400px" UploaderStyle="Modern"
UploadingBackColor="#CCFFFF" ThrobberID="myThrobber" />
or you can use UpdatePanel Triggers
<Triggers>
<asp:PostBackTrigger ControlID="YourControlID" />
</Triggers>
I spent all afternoon on this today, using any number of solutions I found on various forums, including this one, CodeProject.com, asp.net forums, and a whole slew of others. I tried setting Postback triggers and AsyncPostback triggers, and this late at night I can't remember what all else. None of them worked, including the one marked as the answer on this page. What I finally found was an obscure post from 2007 on the asp.net forum which, for some reason now will not load on my browser. At any rate, what finally worked for me was replacing the
<form id="form1" runat="server>
tag with this:
<form id="Form1" method="post" enctype="multipart/form-data" runat="server">
Worked beautifully.
In my case it was in the Site.Master file, but in the case of the posting on forums.asp.net, it worked in a default.aspx file.
Update: The forums.asp.net site was down, but it's back up now: UpdatePanel + FileUpload + PostBackTrigger doesn't seem to work.