I have a dropdown in a vb.net application that is also using radwindow as it's modal. I have the dropdown databinding in the if not ispostback method, yet when I select a value and run it, it still returns the first item. I tried using autopostback set to true but doing that also closes the radwindow. Any other work arounds?
<telerik:RadWindow RenderMode="Lightweight" ID="winComments" runat="server" Title="Comments" RestrictionZoneID="ContentTemplateZone" Modal="true" Width="600" Skin="Outlook"
Height="550" Animation="Fade" Left="600" Top="100" CenterIfModal="true" EnableShadow="true" EnableViewState="false">
<ContentTemplate>
<div class="col-sm-12 col-xs-12">
<br />
<div class="col-sm-4 col-xs-4">
<asp:Label ID="lblCommentVin" runat="server" Font-Bold="true" Visible="true"></asp:Label>
</div>
<div class="col-sm-5 col-xs-5">
Department:
<asp:DropDownList ID="ddlDepartments" runat="server"></asp:DropDownList>
</div>
</div>
<div class="col-xs-12">
<br />
<asp:TextBox ID="txtComment" runat="server" Text="" Height="300px" Width="550px" TextMode="MultiLine"></asp:TextBox>
</div>
<br />
<div class="col-md-offset-4">
<asp:ImageButton ID="btnCancel" runat="server" ImageUrl="images/btnCancel.png" OnClick="btnCancel_Click" CssClass="btn btn-sm pull-right" />
<asp:ImageButton ID="btnSave" runat="server" ImageUrl="images/btnSave.png" OnClick="btnSave_Click" CssClass="btn btn-sm pull-right" />
</div>
</ContentTemplate>
</telerik:RadWindow>
and the code behind:
If Not IsPostBack Then
lblCommentVin.Text = vin
commentDeptList = SQLData.getAssignedCommentDepartments(Session("user"))
_departments = New DepartmentRepository().GetAll()
Session("Departments") = _departments
For Each dept As String In commentDeptList
ddlDepartments.Items.Add(New ListItem(dept, dept))
Next
ddlDepartments.DataBind()
The code stops working where im trying to get the selecteditem
Protected Sub btnSave_Click(sender As Object, e As ImageClickEventArgs)
If txtComment.Text.Length > 1 Then
Dim DepartmentName As String = ddlDepartments.SelectedItem.ToString
I have a ModalPopUpExtender that contains a button that display a second ModalPopUpExtender . The problem is that when I show the second ModalPopUpExtender it appears behind the first. Is it any way i can set that the second ModalPopUpExtender was shown ahead of the fist one?
<asp:ToolkitScriptManager ID="ToolkitScriptManagerProfesiones" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanelAgenda" runat="server">
<ContentTemplate>
<DayPilot:DayPilotCalendar ID="DayPilotCalendar1" runat="server" BackColor="#FFFFD5" BorderColor="Black" CssClassPrefix="calendar_default" DayFontFamily="Tahoma" DayFontSize="15pt" DurationBarColor="Blue" EventBackColor="White" EventBorderColor="Black" EventClickHandling="PostBack" EventFontFamily="Tahoma" EventFontSize="8pt" EventHoverColor="Gainsboro" HourBorderColor="#EAD098" HourFontFamily="Tahoma" HourFontSize="16pt" HourHalfBorderColor="#F3E4B1" HourNameBackColor="#ECE9D8" HourNameBorderColor="#ACA899" HourWidth="100" HoverColor="#FFED95" NonBusinessBackColor="#FFF4BC" StartDate="2015-03-25" TimeFormat="Clock24Hours" CellHeight="40" HeaderHeight="40" OnEventClick="DayPilotCalendar1_EventClick" OnTimeRangeSelected="DayPilotCalendar1_TimeRangeSelected" style="top: 0px; left: 0px; width: 375px; height: 501px; margin-right: 221px" Width="600px" TimeRangeSelectedHandling="PostBack" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:ModalPopupExtender ID="modificarTurno_ModalPopupExtender" runat="server" Enabled="True" PopupControlID="PanelModificarTurno" DropShadow="false" BackgroundCssClass="FondoAplicacion" TargetControlID="lb">
</asp:ModalPopupExtender>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" Enabled="True" PopupControlID="panelClientes" DropShadow="false" BackgroundCssClass="FondoAplicacion" TargetControlID="lbClientePop">
</asp:ModalPopupExtender>
<asp:Button ID="Button1" class="btn btn-info" runat="server" Text="Modificar" Visible="false" />
<asp:Panel ID="panelClientes" runat="server" >
<asp:Label ID="lbClientePop" runat="server" Style="display: none " ></asp:Label>
<asp:UpdatePanel ID="UpdatePanelCliente" runat="server">
<ContentTemplate>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" >
<h2> prueba</h2>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<asp:Panel ID="PanelModificarTurno" runat="server" >
<asp:Label ID="Lb" runat="server" Style="display: none"></asp:Label>
<asp:UpdatePanel ID="UpdatePanelModificarTurno" runat="server">
<ContentTemplate>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" >
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabelModificar16">Modificar turno</h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<fieldset>
<div class="form-group">
<label for="DropDownEstado" class="col-lg-2 control-label">Estado</label>
<div class="col-lg-6">
<asp:DropDownList ID="DropDownEstado" runat="server" CssClass="form-control" DataSourceID="SqlDataSourceEstado" DataTextField="estado" DataValueField="id"></asp:DropDownList>
<asp:SqlDataSource runat="server" ID="SqlDataSourceEstado" ConnectionString='<%$ ConnectionStrings:MiWeb.Properties.Settings.cs %>' SelectCommand="SELECT * FROM [Estado]"></asp:SqlDataSource>
</div>
</div>
<div class="form-group">
<asp:UpdatePanel ID="updatepanelboton" runat="server">
<ContentTemplate>
<label for="txtCliente" class="col-lg-2 control-label">Cliente</label>
<div class="col-lg-4">
<asp:TextBox ID="txtCliente" class="form-control" runat="server"></asp:TextBox>
</div>
<div class="col-lg-2">
<asp:Button runat="server" ID="BtnBuscarCliente" Text="..." OnClick="BtnBuscarCliente_Click" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="form-group">
<label for="DropdownServicios" class="col-lg-2 control-label">Servicio</label>
<div class="col-lg-6">
<asp:DropDownList ID="DropdownServicios" runat="server" CssClass="form-control" DataSourceID="SqlDataSourceServicios" DataTextField="nombre" DataValueField="id" OnSelectedIndexChanged="DropdownServicios_SelectedIndexChanged"></asp:DropDownList>
<asp:SqlDataSource runat="server" ID="SqlDataSourceServicios" ConnectionString='<%$ ConnectionStrings:MiWeb.Properties.Settings.cs %>' SelectCommand="SELECT * FROM [Servicios] WHERE ([activo] = #activo)">
<SelectParameters>
<asp:Parameter DefaultValue="true" Name="activo" Type="Boolean" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</div>
<div class="form-group">
<label for="DropDownProfesioanles" class="col-lg-2 control-label">Profesional</label>
<div class="col-lg-6">
<asp:DropDownList ID="DropDownProfesioanles" runat="server" CssClass="form-control" ></asp:DropDownList>
</div>
</div>
<div class="form-group">
<label for="ChkPrimeraVez" class="col-lg-2 control-label">Primera vez? </label>
<div class="col-lg-6">
<asp:CheckBox ID="ChkPrimeraVez" runat="server" />
</div>
</div>
<div class="form-group">
<label for="DropDownHsInicio" class="col-lg-2 control-label">Inicio</label>
<div class="col-lg-4">
<asp:DropDownList ID="DropDownHsInicio" runat="server" CssClass="form-control" DataSourceID="SqlDataSourceHI" DataTextField="hora" DataValueField="id"></asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSourceHI" runat="server" ConnectionString='<%$ ConnectionStrings:MiWeb.Properties.Settings.cs %>' SelectCommand="SELECT * FROM [horarios]"></asp:SqlDataSource>
</div>
<label for="DropDownHsFin" class="col-lg-2 control-label">Fin</label>
<div class="col-lg-4">
<asp:DropDownList ID="DropDownListFin" runat="server" CssClass="form-control" DataSourceID="SqlDataSourceFI" DataTextField="hora" DataValueField="id" Enabled="False"></asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSourceFi" runat="server" ConnectionString='<%$ ConnectionStrings:MiWeb.Properties.Settings.cs %>' SelectCommand="SELECT * FROM [horarios]"></asp:SqlDataSource>
</div>
</div>
</fieldset>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnEliminarTurno" runat="server" class="btn btn-danger" Text="Eliminar turno" OnClick="BtnEliminarTurno_Click" />
<asp:Button ID="btnCancelarMod" runat="server" class="btn btn-default" Text="Cancelar" OnClick="btnCancelarMod_Click" />
<asp:Button ID="btnConfirmarMod" runat="server" class="btn btn-success" Text="Modificar" OnClick="btnConfirmarMod_Click" />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
protected void btnConfirmarMod_Click(object sender, EventArgs e)
{
modificarTurno_ModalPopupExtender.Hide();
}
protected void BtnBuscarCliente_Click(object sender, EventArgs e)
{
ModalPopupExtender1.Show();
}
thanks in advance !
ModalPopupExtender "decides" on its own what z-index to use. Generally it will do the right thing.
The only way I know to assure that your second one will appear on top is to Not use a second ModalPopupExtender, but instead to assign the z-index of the second modal popup explicitly. I suggest 99999 for the second popup and 99998 for its blanket. I have seen typical z-index assigned by ModalPopupExtender in ranges of 50000 to 79000 (aprox).
i want to use jasny image upload for adding new image and editing previous image simultaneously in asp.net webform.
i have a hidden div pan for adding and editing news , that is been visible by button clicks;
this is my News.aspx page cod:
<div id="AddNewNews" class="col-lg-12" runat="server" visible="false">
<div class="form-group">
<div class="col-lg-2">
<asp:Label ID="lblTitle" runat="server" Text="Title">
</asp:Label>
</div>
<div class="col-lg-10">
<asp:RequiredFieldValidator ID="ReqValTxtTitle"
runat="server" ValidationGroup="group1" EnableClientScript="true"
ControlToValidate="txtTitle" ForeColor="Red" Text="*" />
<asp:TextBox ID="txtTitle" runat="server" CssClass="form-control" MaxLength="100"></asp:TextBox>
</div>
<div class="clr"></div>
</div>
<div class="form-group">
<div class="col-lg-2">
<asp:Label ID="lblSummary" runat="server" Text="Summary">
</asp:Label>
</div>
<div class="col-lg-10">
<asp:RequiredFieldValidator ID="ReqValTxtSummary" EnableClientScript="true" ForeColor="Red" runat="server" ValidationGroup="group1"
ControlToValidate="txtSummary" Text="*" />
<asp:TextBox ID="txtSummary"
runat="server" onkeypress="return CheckLength();"
TextMode="MultiLine" CssClass="form-control"
MaxLength="200">
</asp:TextBox>
</div>
<div class="clr"></div>
</div>
<div class="form-group">
<div class="col-lg-2">
<asp:Label ID="lblDesc" runat="server" Text="Description">
</asp:Label>
</div>
<div class="col-lg-10">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ValidationGroup="group1" EnableClientScript="true"
ControlToValidate="CKEditor1" ForeColor="Red" Text="*" />
<CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" runat="server"></CKEditor:CKEditorControl>
</div> <div class="clr"></div>
</div>
<div class="form-group">
<div class="col-lg-2">
<asp:Label ID="lblImg" runat="server" Text="Select Picture">
</asp:Label>
</div>
<div class="col-lg-2">
<div class="fileinput <%=Session["statusNE"]%>" data-provides="fileinput" data-name="NewsImg">
<input type="hidden" name="NewsImg" value="1" runat="server" />
<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;">
<img src="~/Content/images/200x150.png" alt="No Image">
</div>
<div class="fileinput-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;">
<img src="#" runat="server" id="NewsImageUrl" />
</div>
<div style="text-align: center;">
<span class="btn btn-default btn-file"><span class="fileinput-new">Select</span>
<span class="fileinput-exists">Change</span>
<input type="file" name="NewsImg" id="NewsImg" runat="server">
</span>
Remove
</div>
</div>
</div>
</div>
Session["statusNE"] shows "fileinput-exists" or "fileinput-new";
but in adding new news mode, shows 2 box for image;
how can i manage it?
Thanks.
<div class="controls">
<div class="thumbnail" style="width: 291px; height: 200px;">
<asp:Image ID="myimage" runat="server" Height="200px" />
</div>
</div>
<div class="space10">
</div>
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="input-append">
<div class="uneditable-input">
<i class="icon-file fileupload-exists"></i><span class="fileupload-preview"></span>
</div>
<span class="btn btn-file"><span class="fileupload-new">Select file</span> <span
class="fileupload-exists">Change</span>
<input id="myFile" type="file" runat="server" onchange="ShowPreview(this)">
</span><a href="#" class="btn fileupload-exists" data-dismiss="fileupload" >Remove</a>
</div>
</div>
function ShowPreview(input) {
debugger;
if (input.files && input.files[0]) {
var ImageDir = new FileReader();
ImageDir.onload = function (e) {
$('#myimage').attr('src', e.target.result);
}
ImageDir.readAsDataURL(input.files[0]);
}
} `
protected HtmlInputFile myFile;
public void fileuploadImage()
{
Guid name = Guid.NewGuid();
if (IsPostBack)
{
if (myFile.PostedFile != null)
{
// File was sent
var postedFile = myFile.PostedFile;
int dataLength = postedFile.ContentLength;
byte[] myData = new byte[dataLength];
postedFile.InputStream.Read(myData, 0, dataLength);
string ext = Path.GetExtension(postedFile.FileName);
string filename = Path.GetFileName(postedFile.FileName);
// name = Guid.Parse(filename);
postedFile.SaveAs(Server.MapPath("ProfileImage/" + name + ext));`
I have a 3-level asp.net repeater, and I need to find the 3rd level's items. The code-behind is posted below as well.
Here is my aspx code:
<div class="container">
<asp:Repeater runat="server" ID="rptGrp0" OnItemDataBound="rptGrp0_ItemDataBound">
<HeaderTemplate>
<div id="Grp0" class="rptParent">
</HeaderTemplate>
<ItemTemplate>
<div id="rptParent <%# Eval("Name") %>">
<div class="row-fluid">
<div class="span12">
<h5 class="parentTitle"><%# Eval("Name") %></h5>
</div>
</div>
</div>
<div class="group">
<div id="rptChild <%# Eval("Name") %>">
<div>
<asp:Repeater runat="server" ID="rptGrp1" OnItemDataBound="rptGrp1_ItemDataBound">
<HeaderTemplate>
<div id="Grp1" class="rptChild">
</HeaderTemplate>
<ItemTemplate>
<div class="group">
<div id="rptGrandChildHeader <%# Eval("Name") %>">
<div class="content">
<div class="container">
<div class="row-fluid">
<div class="span12">
<p class="blue">
<asp:Label runat="server" ID="lblChildName" Text='<%# Eval("Name") %>'></asp:Label>
</p>
</div>
</div>
</div>
</div>
</div>
<div id="rptGrandChild <%# Eval("Name") %>">
<asp:Repeater runat="server" ID="rptContent">
<HeaderTemplate>
<div class="c_module">
<div class="container">
<div class="row-fluid">
<div class="span12">
<div class="data_controls">
<div class="clearfix"></div>
</div>
<div class="d_table_module">
<table border="0" class="display" id="tblContent">
<thead>
<tr>
<th>Product</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="width:100px;">
<asp:Label runat="server" ID="lblProduct" Text='<%# Eval("Product") %>'></asp:Label>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
</div>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
Here is my code-behind.
protected void lnkButton_Click(object sender, EventArgs e)
{
Repeater primary = (Repeater)this.FindControl("rptGrp0");
if (primary != null)
{
// Items.Count = 0.
foreach (RepeaterItem item in primary.Items)
{
Repeater secondary = (Repeater)item.FindControl("rptGrp1");
if (secondary != null)
{
foreach (RepeaterItem b in secondary.Items)
{
Repeater target = (Repeater)b.FindControl("rptContent");
if (target != null)
{
foreach (RepeaterItem c in target.Items)
{
}
}
}
}
}
}
}
The problem is that my repeater.Items.Count is 0.
Please advise, thanks.
Repeater will display only if it is bounded with DataSource. Make sure your repeaters are bounded with a proper DataSource.
Finding the items of the 3rd repeater depends on how you databind it to begin with. If you are binding data in your Page_Load event, then the data is bound after the click event is processed. On your lnkButton_Click event the contents of the repeaters have not yet been bound. The easiest way to access those items is to have an Item_DataBound event to access those items.
Sample code:
<asp:Repeater runat="server" ID="rptContent" OnItemDataBound="rptContent_ItemDataBound">
...
</asp:Repeater>
Code Behind:
protected void rptContent_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
e.Item; // This current item
Repeater rpt = (Repeater)(sender);
rpt.Items; // All items
//Do some condition here to test on the item for whatever you want to do
if(e.Item == someCondition)
// some operation here
}
Okay I found the solution. It has to do with the ASP.NET page lifecycle.
After the lnkButton_Click event, a postback occurred, but I needed to "rebind" the repeater datasource on postback, not just initial page_load.
e.g.
protected void Page_Load()
{
if (!IsPostBack)
{
// bind control
}
else
{
// rebind control
}
}
i have inquiry form which gets open in modal popup extender. when i click on button to store data click event does not get fired
i don't know whats going wrong can any one help me to solve this problem
thanks in advance
here is my code
DefaultMaster.master
<%# Master Language="C#" AutoEventWireup="true" CodeFile="DefaultMasterPage.master.cs"
Inherits="DefaultMasterPage" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link type="text/css" rel="Stylesheet" href="../JyotiInstitute/Styles/StyleSheet.css" />
<link type="text/css" rel="Stylesheet" href="../JyotiInstitute/Styles/sliderman.css" />
<link type="text/css" rel="Stylesheet" href="../JyotiInstitute/Styles/style1.css" />
<link type="text/css" rel="Stylesheet" href="../JyotiInstitute/Styles/style2.css" />
<script type="text/javascript" src="Script/jquery-1.3.2.js"></script>
<script type="text/javascript" src="Script/scroll-startstop.events.jquery.js"></script>
<script type="text/javascript" src="Script/sliderman.1.3.7.js"></script>
<script type="text/javascript" src="Script/easytabs.js"></script>
<script type="text/javascript" src="Script/modernizr.custom.04022.js"></script>
<script type="text/javascript" src="Script/modernizr.custom.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#toTop').fadeIn();
} else {
$('#toTop').fadeOut();
}
});
$('#toTop').click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
});
$(function () {
$('.fadein img:gt(0)').hide();
setInterval(function () {
$('.fadein :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('.fadein');
},
4000);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<div class="page-wrap">
<div id="absolute">
<div id="div1" class="div1">
<asp:ImageButton runat="server" ImageUrl="Images/sef111.png" Style="margin-top: 10px;
margin-left: 5px" ID="OpenPopUp1" CausesValidation="false" OnClick="OpenPopUp1_Click" />
<asp:Button ID="btnPopUp1" runat="server" Style="display: none" />
</div>
<div id="div2" class="div2">
<asp:ImageButton ID="OpenPopUp2" runat="server" ImageUrl="Images/scef1.png" Style="margin-top: 2px;"
CausesValidation="false" OnClick="OpenPopUp2_Click" />
<asp:Button ID="btnPopUp2" runat="server" Style="display: none" />
</div>
</div>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground"
PopupControlID="Panel1" TargetControlID="btnPopUp1" CancelControlID="btnClose1">
</asp:ModalPopupExtender>
<asp:Panel runat="server" ID="Panel1" CssClass="modalPopup" align="center" Style="display: none">
<center>
<div class="outer_div">
<div class="inner_div">
<h1>
Student Enquiry Form</h1>
</div>
<div>
<br />
<asp:Literal runat="server" Text=" Your enquiry sent successfully..." ID="ltrMsg1"
Visible="false"></asp:Literal>
<br />
<asp:Label ID="Label2" runat="server" Text="Fileds marked with * are mandatory"></asp:Label>
<br />
<br />
<center>
<table>
<tr>
<td>
<asp:DropDownList ID="drpCourses" runat="server" CssClass="select">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtName" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender2" runat="server" TargetControlID="txtName" WatermarkText="* Full Name ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtEmail" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender3" runat="server" TargetControlID="txtEmail" WatermarkText="* E-mail ID ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server" Text="+91" ReadOnly="true" CssClass="textbox"
Width="30px"></asp:TextBox>
<asp:TextBox runat="server" ID="txtMobile" CssClass="textbox" Width="172px"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender4" runat="server" TargetControlID="txtMobile" WatermarkText="* Mobile number ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtCity" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender6" runat="server" TargetControlID="txtCity" WatermarkText="City ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtState" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender5" runat="server" TargetControlID="txtState" WatermarkText="State ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtComments" TextMode="MultiLine" CssClass="textboxMulti"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender7" runat="server" TargetControlID="txtComments" WatermarkText="Comments ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<br />
<center>
<asp:Button ID="btnSave" Text="Save" runat="server" CssClass="btnConrol"
onclick="btnSave_Click" />
</center>
</td>
</tr>
</table>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please select course"
SetFocusOnError="true" ControlToValidate="drpCourses" CssClass="ErrorMsg"></asp:RequiredFieldValidator><br />--%>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter full name"
SetFocusOnError="true" ControlToValidate="txtName" CssClass="ErrorMsg"></asp:RequiredFieldValidator><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please enter Email-ID"
SetFocusOnError="true" ControlToValidate="txtEmail" CssClass="ErrorMsg"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtEmail"
ValidationExpression="\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*" runat="server"
CssClass="ErrorMsg" SetFocusOnError="true" ErrorMessage="Invalid Email" /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Please enter mobile number"
SetFocusOnError="true" ControlToValidate="txtMobile" CssClass="ErrorMsg"></asp:RequiredFieldValidator>
</center>
</div>
</div>
</center>
<asp:ImageButton ImageUrl="Images/close1.png" runat="server" ID="btnClose1" Style="float: right;
margin-top: -645px; margin-right: -20px;" />
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender_2" runat="server" BackgroundCssClass="modalBackground"
PopupControlID="Panel2" TargetControlID="btnPopUp2" CancelControlID="btnClose2">
</asp:ModalPopupExtender>
<asp:Panel runat="server" ID="Panel2" CssClass="modalPopup" align="center" Style="display: none">
<center>
<div class="outer_div">
<div class="inner_div">
<h1>
Institute Enquiry Form</h1>
</div>
<div>
<br />
<asp:Literal runat="server" Text=" Your enquiry sent successfully..." ID="ltrMsg2"
Visible="false"></asp:Literal>
<br />
<asp:Label ID="Label1" runat="server" Text="Fileds marked with * are mandatory"></asp:Label><br />
<br />
<table>
<tr>
<td>
<asp:TextBox runat="server" ID="txtFullName" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender8" runat="server" TargetControlID="txtFullName" WatermarkText="* Full Name ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtEmailId" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender9" runat="server" TargetControlID="txtEmailId" WatermarkText="* E-mail ID ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="TextBox3" runat="server" Text="+91" ReadOnly="true" CssClass="textbox"
Width="30px"></asp:TextBox>
<asp:TextBox runat="server" ID="txtMobileNum" CssClass="textbox" Width="172PX"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender10" runat="server" TargetControlID="txtMobileNum"
WatermarkText="* Mobile number ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtCityName" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender11" runat="server" TargetControlID="txtCityName"
WatermarkText="City ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtStateName" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender12" runat="server" TargetControlID="txtStateName"
WatermarkText="State ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtPin" CssClass="textbox"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender14" runat="server" TargetControlID="txtPin" WatermarkText="Pin Code ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<asp:TextBox runat="server" ID="txtComment" TextMode="MultiLine" CssClass="textboxMulti"></asp:TextBox><asp:TextBoxWatermarkExtender
ID="TextBoxWatermarkExtender13" runat="server" TargetControlID="txtComment" WatermarkText="Comments ">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
<tr>
<td>
<br />
<center>
<asp:Button runat="server" ID="btnStore" Text="Save" CssClass="btnConrol"
onclick="btnStore_Click" />
</center>
</td>
</tr>
</table>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="Field cannot be left blank"
SetFocusOnError="true" ControlToValidate="txtFullName" CssClass="ErrorMsg"></asp:RequiredFieldValidator><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="Field cannot be left blank"
SetFocusOnError="true" ControlToValidate="txtEmailId" CssClass="ErrorMsg"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regEmail" ControlToValidate="txtEmailId" ValidationExpression="\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*"
runat="server" CssClass="ErrorMsg" SetFocusOnError="true" ErrorMessage="Invalid Email" /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="Field cannot be left blank"
SetFocusOnError="true" ControlToValidate="txtMobileNum" CssClass="ErrorMsg"></asp:RequiredFieldValidator>
</div>
</div>
</center>
<asp:ImageButton ImageUrl="Images/close1.png" runat="server" ID="btnClose2" Style="float: right;
margin-top: -630px; margin-right: -20px;" />
</asp:Panel>
<div id="head-wrap">
<div id="back-wrap">
</div>
<div id="menu">
<ul class="tabs">
<li>News </li>
<li>E-Prospectus</li>
<li>Help Center</li>
<li>Contact Us</li>
<li>Test</li>
</ul>
</div>
<div id="tab-container">
<div id="tabs">
<div id="logo_hm">
<div id="hm_outer">
<a href="Index.aspx">
<img alt="" src="Images/hm.png" style="margin-left: 4px; margin-top: 4px; border-radius: 5px" /></a>
</div>
</div>
<div id="tab_outer">
<div id="MainMenu">
<center>
<ul id="nav">
<li style="display: inline"><span>Home</span></li>
<li style="display: inline; top: 0px; left: 0px;"><a href="AboutUs.aspx"><span>About
Us</span></a> </li>
<li style="display: inline"><span>Academics</span>
<ul class="nav first">
<li>Overview</li>
<li>Ordinances & Regulations</li>
<li>Programmes </li>
</ul>
</li>
<li style="display: inline; width: 100px"><span>Study Centers</span>
<ul class="nav first">
<li>Join As Study Center</li>
</ul>
</li>
<li style="display: inline"><span>Downloads</span></li>
</ul>
</center>
</div>
<div id="search-box">
<div id="searchwrapper">
<form action="">
<asp:TextBox runat="server" ID="txtSearch" CssClass="searchbox"></asp:TextBox>
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtSearch"
WatermarkText="Courses, Study Centers">
</asp:TextBoxWatermarkExtender>
<%-- <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="Images/search1.png"
CssClass="searchbox_submit" PostBackUrl="~/Search.aspx" />--%>
<a href="Search.aspx">
<img alt="" src="Images/search1.png" class="searchbox_submit" /></a>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="middle-wrap">
<div id="left">
<div id="logo">
<img alt="" src="Images/Jyoti_logo .jpg" width="100%" height="100%" />
</div>
</div>
<div id="right">
<div style="float: left;">
<div id="slider">
<div id="Div3" class="fadein">
<img src="Images/c1.jpg" alt="" />
<img src="Images/c2.jpg" alt="" />
<img src="Images/c3.jpg" alt="" />
<img src="Images/c4.jpg" alt="" />
<img src="Images/c5.jpg" alt="" />
</div>
<div class="SliderName_3Description">
<span>Jyoti Institute of IT & Management</span>
<br />
<span style="text-transform: none; font-size: 14px">Jaunpur (UP)</span>
</div>
<%-- <div class="slider">
<center>
<div id="slider_container_3">
<div id="SliderName_3">
<img alt="" src="Images/c1.jpg" />
<img alt="" src="Images/c2.jpg" />
<img alt="" src="Images/c3.jpg" /><img alt="" src="Images/c5.jpg" />
<img alt="" src="Images/c4.jpg" />
</div>
<div class="SliderName_3Description">
<span>Jyoti Institute of IT & Management</span>
<br />
<span style="text-transform: none; font-size: 14px">Jaunpur (UP)</span>
</div>
</div>
</center>
<script type="text/javascript">
demo3Effect1 = { name: 'myEffect31', top: true, move: true, duration: 400 };
demo3Effect2 = { name: 'myEffect32', right: true, move: true, duration: 400 };
demo3Effect3 = { name: 'myEffect33', bottom: true, move: true, duration: 400 };
demo3Effect4 = { name: 'myEffect34', left: true, move: true, duration: 400 };
demo3Effect5 = { name: 'myEffect35', rows: 3, cols: 9, delay: 50, duration: 100, order: 'random', fade: true };
demo3Effect6 = { name: 'myEffect36', rows: 2, cols: 4, delay: 100, duration: 400, order: 'random', fade: true, chess: true };
effectsDemo3 = [demo3Effect1, demo3Effect2, demo3Effect3, demo3Effect4, demo3Effect5, demo3Effect6, 'blinds'];
var demoSlider_3 = Sliderman.slider({ container: 'SliderName_3', width: 790, height: 300, effects: effectsDemo3,
display: { autoplay: 3000 },
description: { background: '#000000', opacity: 0.5, height: 30, position: 'bottom' }
});
</script>--%>
</div>
</div>
</div>
</div>
</div>
<div id="Content-wrap">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div class="site-footer">
<center>
<span>© Copyrights, 2013 Jyoti Institute | Designed & Developed by Weblord Infotech</span>
</center>
</div>
</form>
</body>
</html>
DefaultMaster.master.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class DefaultMasterPage : System.Web.UI.MasterPage
{
Enquiry objEnquiry = new Enquiry();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void OpenPopUp1_Click(object sender, ImageClickEventArgs e)
{
ModalPopupExtender1.Show();
}
protected void OpenPopUp2_Click(object sender, ImageClickEventArgs e)
{
ModalPopupExtender_2.Show();
}
private void Clear()
{
drpCourses.SelectedIndex = 0;
txtName.Text = "";
txtFullName.Text = "";
txtEmail.Text = "";
txtEmailId.Text = "";
txtMobile.Text = "";
txtMobileNum.Text = "";
txtCity.Text = "";
txtCityName.Text = "";
txtState.Text = "";
txtStateName.Text = "";
txtPin.Text = "";
txtComment.Text = "";
txtComments.Text = "";
}
protected void btnStore_Click(object sender, EventArgs e)
{
//Studycenter enquiry form
//objEnquiry.EnterStudyCenterEnquiry(0, txtFullName.Text, txtEmailId.Text, txtMobileNum.Text, txtCityName.Text, txtStateName.Text, txtPin.Text, txtComment.Text);
ltrMsg2.Visible = true;
Clear();
}
protected void btnSave_Click(object sender, EventArgs e)
{
//Student enquiry form
//objEnquiry.EnterStudentEnquiry(0, drpCourses.SelectedItem.Text, txtName.Text, txtEmail.Text, txtMobile.Text, txtCity.Text, txtState.Text, txtComments.Text);
ltrMsg1.Visible = true;
Clear();
}
}
Is a request being submited to the server or is it not doing anything it all?
In the case of nothing happening my experience usually is a validationhandler that's invisible and blocking the call.
Try adding causesValidation="False" to your save button as a test to see if that is the issue
If it works without validation find the validator that's failing and fix it ! ;)
In my case I used UseSubmitBehavior="false". The reason behind this is explained here:
Microsoft Docs on UseSubmitBehavior
Gets or sets a value indicating whether the Button control uses the client browser's submit mechanism or the ASP.NET postback mechanism.
It appears that instead of trying to postback it was using the client browser submit so my code behind wasnt firing,