How to make Dropdownlist have multiple checkboxes? - asp.net

I have an aspx page and within the page I have a dropdownlist. On pageload, I add some choices to the dropdownlist. But I want to be able to select more than one option from this list when I click the dropdownlist, like a window which opens below of it and has a checkboxlist with the same choices.
How can I add multiple checkboxes to the dropdownlist, or make a checkboxlist in this manner? Should I use JQuery?
Thanks in advance.

For MultiCheckbox Dropdown in Asp.net , Use the following code enter image description here
First refer the ajaxtoolkit assembply in file
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
Then add Script Manager
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release">
</asp:ScriptManager>
Use the following Html Code
<asp:TextBox ID="txtClient" placeholder="Select Clients" runat="server" CssClass="txtbox" ReadOnly="true" Height="28px" Width="250px" Style="margin-bottom: auto; text-align: center; background-color: White; cursor: pointer; border-color: black; margin: 1px;"></asp:TextBox>
<asp:Panel ID="PnlClientlist" runat="server" CssClass="PnlDesign" Style="">
<asp:CheckBox ID="cbAll" runat="server" Text="Select All" BackColor="Aqua" onclick="CheckAll();" />
<asp:CheckBoxList ID="drpClients" runat="server" onclick="UnCheckAll();">
</asp:CheckBoxList>
</asp:Panel>
<cc1:PopupControlExtender ID="PceSelectClient" runat="server" TargetControlID="txtClient"
PopupControlID="PnlClientlist" Position="Bottom">
</cc1:PopupControlExtender>
Add the above reference in cocde
Use Css and JS:
function CheckAll() {
var count = 0;
$('#' + '<%=drpClients.ClientID %>' + ' input:checkbox').each(function () {
count = count + 1;
});
for (i = 0; i < count; i++) {
if ($('#' + '<%=cbAll.ClientID %>').prop('checked') == true) {
if ('#' + '<%=drpClients.ClientID %>' + '_' + i) {
if (('#' + '<%=drpClients.ClientID %>' + '_' + i).disabled != true)
$('#' + '<%=drpClients.ClientID %>' + '_' + i + ':checkbox').prop('checked', true);
}
}
else {
if ('#' + '<%=drpClients.ClientID %>' + '_' + i) {
if (('#' + '<%=drpClients.ClientID %>' + '_' + i).disabled != true)
$('#' + '<%=drpClients.ClientID %>' + '_' + i + ':checkbox').prop('checked', false);
}
}
}
}
function UnCheckAll() {
var flag = 0;
var count = 0;
$('#' + '<%=drpClients.ClientID %>' + ' input:checkbox').each(function () {
count = count + 1;
});
for (i = 0; i < count; i++) {
if ('#' + '<%=drpClients.ClientID %>' + '_' + i) {
if ($('#' + '<%=drpClients.ClientID %>' + '_' + i).prop('checked') == true) {
flag = flag + 1;
}
}
}
if (flag == count)
$('#' + '<%=cbAll.ClientID %>' + ':checkbox').prop('checked', true);
else
$('#' + '<%=cbAll.ClientID %>' + ':checkbox').prop('checked', false);
}
.PnlDesign
{
border: solid 1px #000000;
height: 300px;
width: 330px;
overflow-y: scroll;
background-color: white;
font-size: 15px;
font-family: Arial;
width: 450px;
}
.txtbox
{
background-image: url(img/drpdwn.png);
background-position: right center;
background-repeat: no-repeat;
cursor: pointer;
cursor: hand;
background-size: 20px 30px;
}

Probably you have to implement a custom control.
Take a look: http://www.codeproject.com/Articles/18063/Multi-select-Dropdown-list-in-ASP-NET

In My razor view it works please change to required aspx view
#Html.DropDownList("selectedclients", new SelectList(Model.ListClients, "ClientId", "FullName", 1), "---Select clients---", new { #class =multiple = "multiple", id = "clients" })
where ListClients is an IEnumerable list
also add jquery-1.4.4.min.js and jquery.multiSelect.js in view
and in load add
<script type="text/javascript">
$(document).ready(function () {
$("#clients").multiSelect({ oneOrMoreSelected: '*' });
});
</script>

Related

css moving div below text results

I am trying to move a div below auto complete search results. But i am unable to push the div below autocomplete results after user starts typing. I am trying to implement searchbox similar to www.microsoft.com. Any help would be highly appreciated.
Here is my Fiddle code
<input name="query" id="pageSearchField" type="text" maxlength="50" value="" class="ui-autocomplete-input" autocomplete="off">
var availableTags = [
"Details",
"Project ",
"Release ",
"Property ",
"Application",
"Last Modified By",
"Last Modified Date",
"Tagged by"
];
$("#pageSearchField").autocomplete({
source: availableTags
});
$("#pageSearchField").click(function () {
$('#bottom-div').show("slow");
});
$('#pageMainRegion').click(function () {
$('#bottom-div').hide("slow");
});
$('#bottom-div>div').css("background-color", "white");
var firstFilterText = "Search Data Centers";
var secondFilterText = "Search Projects";
var thirdFilterText = "Search Orders";
$("#pageSearchField").after("" +
"<div id=" + "bottom-div" + "><div>" + firstFilterText + "</div>" +
"<div>" + secondFilterText + "</div>" +
"<div>" + thirdFilterText + "</div></div>");
$('#bottom-div>div').click(function () {
$('#bottom-div>div').css("background-color", "white");
$('#bottom-div>div').css("color", "black");
$(this).css("background-color", "gray");
$(this).css("color", "white");
});
#bottom-div {
z-index: 999;
position: absolute;
min-width: 290px;
background: #fff;
padding: 10px;
border: 1px solid #ccc;
height: 80px;
cursor: pointer;
display: none;
border-top-color: #000;
}
#bottom-div > div {
padding-bottom: 5px;
}
Since Ui-Autocomplete has position:absolute, it will not affect page layout in the normal way and it will not push elements below it.
One approach is to extend the ui autocomplete to render with your div at the bottom of the autocomplete (jsFiddle)
$.widget( "custom.autocompletePlus", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var original = this._super(ul, items);
$(ul).append(
"<p>Your Html goes here</p>"
);
}
});
$("#pageSearchField").autocompletePlus({
source: availableTags,
});
change your jQuery like this:
$(".ui-autocomplete").after("" +
"<div id=" + "bottom-div" + "><div>" + firstFilterText + "</div>" +
"<div>" + secondFilterText + "</div>" +
"<div>" + thirdFilterText + "</div></div>");
remove position:absolute from your bottom-div and add this class to your CSS:
.ui-autocomplete{
position:relative;
top:0;
left:0;
}
DEMO
with some style you can create what you want.

How to disable weekends in the ajax calender extender?

I have implemented the following code: this function not call
My Html Code is:
<asp:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yy" PopupButtonID="ImageButton1" PopupPosition="BottomRight" Enabled="true" OnClientDateSelectionChanged="DisableWeekends" TargetControlID="txtStartDate">
onclientshown=`"DisableWeekends"
The function is give below:
function DisableWeekends(sender, args) {
for (var i = 0; i < sender._days.all.length; i++) {
for (var j = 0; j < 6; j++) {
if (sender._days.all[i].id == "DisabledWeekendsCalendar" + j + "_5") {
sender._days.all[i].disabled = true;
sender._days.all[i].innerHTML =
"<div>" + sender._days.all[i].innerText + "</div>";
}
if (sender._days.all[i].id == "DisabledWeekendsCalendar" + j + "_6") {
sender._days.all[i].disabled = true;
sender._days.all[i].innerHTML =
"<div>" + sender._days.all[i].innerText + "</div>";
}
}
}
}
Try this
<script type="text/javascript">
//disable sunday
function detect_sunday(sender, args) {
if (sender._selectedDate.getDay() == 0) {
sender._selectedDate = new Date();
// set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format));
alert("You can't select sunday!");
}
}
</script>
<asp:CalendarExtender ID="calenderExtender" runat="server" CssClass="cal_theme" TargetControlID="txtCalender"
PopupButtonID="BtnCalender" OnClientDateSelectionChanged="detect_sunday"/>
Using CSS
.DisableWeekends .ajax__calendar_days table tbody tr td:first-child
{
text-decoration: line-through;
color: red;
pointer-events: none;
cursor: default;
}
After that add DisableWeekends class in CalendarExtender controller.

Custom CSS to SliderExtender in ASP.NET

I'm building web app using asp.net web forms and i have a SliderExtender in a TemplateField of a Grid View as below.
<ajaxToolkit:SliderExtender ID="SliderExtender1" runat="server" TargetControlID="txtbox_count"
BoundControlID="txtbox_count_BoundControl" Orientation="Horizontal" EnableHandleAnimation="true"
RailCssClass="SliderRail" HandleCssClass="SliderHandle" HandleImageUrl="~/Images/slider_h_handle.gif"
Minimum="0" Maximum='<%# double.Parse(Eval("VEHICLE_TYPE.MAX_AMOUNT").ToString()) %>'>
</ajaxToolkit:SliderExtender>
<asp:TextBox ID="txtbox_count" Width="25" runat="server" Text='<%# Bind("VEHICLE_AVAILABILITY.EXIST_COUNT") %>'
Style="text-align: right"></asp:TextBox>
<asp:TextBox ID="txtbox_count_BoundControl" Width="25" runat="server" Text='<%# Bind("VEHICLE_AVAILABILITY.EXIST_COUNT") %>'
Style="text-align: right"></asp:TextBox>
CSS of RailCssClass and HandleCssClass
.SliderHandle
{
position: absolute;
height: 22px;
width: 10px;
}
.SliderRail
{
position: relative;
background: url('../../Images/slider_h_rail.gif') repeat-x;
height: 22px;
width: 125px;
}
This looks like below.
But I need to customize the slider like below.
How can I do this? What should I change in my css class?
Here I have created example
Download sample from http://jqueryui.com/resources/download/jquery-ui-1.10.3.zip
include all necessory resource like jquery, CSS, images etc from demo into your project
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="TestSf.WebForm2" %>
<%# Register Src="SliderControl.ascx" TagName="SliderControl" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:GridView runat="server" ID="grd" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="MaxValue" HeaderText="MaxValue" SortExpression="MaxValue" />
<asp:TemplateField HeaderText="Slider">
<ItemTemplate>
<uc1:SliderControl ID="SliderControl1" runat="server" ctrlID='<%# Eval("ID") %>'
Maxvalue='<%# Eval("MaxValue") %>' Value='<%# Eval("Value") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<script type="text/javascript">
if(arr.indexOf($(this).val())>-1)
{
alert('This is already selected , please select other option');
return false;
}
</script>
</asp:Content>
c# Sample code
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<TestMax> lst = new List<TestMax>();
lst.Add(new TestMax() { ID = 1, MaxValue = 10, Value = 4, Name = "Sandeep" });
lst.Add(new TestMax() { ID = 2, MaxValue = 12, Value = 3, Name = "Nilesh" });
lst.Add(new TestMax() { ID = 3, MaxValue = 11, Value = 6, Name = "Jayesh" });
grd.DataSource = lst;
grd.DataBind();
}
}
public class TestMax
{
public int ID { get; set; }
public string Name { get; set; }
public int MaxValue { get; set; }
public int Value { get; set; }
}
Create a new USerControl and use this markup
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="SliderControl.ascx.cs"
Inherits="TestSf.SliderControl" %>
<script>
$(function () {
$("#slider-range-max<%= ctrlID %>").slider({ range: "max", min: 1, max: <%= Maxvalue %>,
value: <%= Value %>, slide: function (event, ui) { $("#amount<%= ctrlID %>").val(ui.value); }
});
$("#amount<%= ctrlID %>").val($("#slider-range-max<%= ctrlID %>").slider("value"));
});
</script>
<div id="slider-range-max<%= ctrlID %>">
</div>
<input type="text" id="amount<%= ctrlID %>" style="border: 2; color: #f6931f; font-weight: bold;" />
UserControl C# code
public partial class SliderControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public int ctrlID { get; set; }
public int Maxvalue { get; set; }
public int Value { get; set; }
}
You can apply styles using the following properties.
RailCssClass="ajax__slider_h_rail"
HandleCssClass="ajax__slider_h_handle"
and their styles as follows, which you can edit according to your requirements.
.ajax__slider_h_rail
{
position:relative;
height:20px;
}
.ajax__slider_h_handle
{
position:absolute;
height:20px;width:10px;
}
.ajax__slider_v_rail
{
position:relative;
width:20px;
}
.ajax__slider_v_handle
{
position:absolute;
height:10px;width:20px;
}
First thing, You are using AjaxControlToolkit slider while, expecting UI as jquery slider.
if you can switch the control, it will solve your issue.
otherwise,
put these css classes
.ajax__slider_h_rail {
border: 1px solid;
border-radius: 3px 3px 3px 3px;
height: 8px;
position: relative;
}
.ajax__slider_h_handle {
height: 22px;
position: absolute;
top: -7px !important;
width: 10px;
}
First use following code to stop showing the default image
.handleStyle img
{
display:none;
}
Then use whatever styles you are using for handle like following
.handleStyle
{
position: absolute;
height: 22px;
width: 22px;
background-color:Red;
border-radius:8px;
}

When using radio button,I'm tring to hide div, the checkbox list[control itself] is not displayed

script:
$(document).ready(function () {
$('#Custom').hide('fast');
$('#rbtnEntire').click(function () {
$('#Custom').hide('fast');
$('#Entire').show('fast');
});
$('#rbtnCustom').click(function () {
$('#Entire').hide('fast');
$('#Custom').show('fast');
});
});
function showdiv() {
document.getElementById("divChkList").style.display = "block";
}
aspx file:
<div style="height:700; width:500;">
<div id="select scan type">
<asp:RadioButton ID="rbtnEntire" runat="server" Text="Entire"
GroupName="s1"/>
<asp:RadioButton ID="rbtnCustom" runat="server" Text="Custom"
GroupName="s1"/>
</div>
<div id="Entire" style="float:left; height:1000; width:1000; border: solid 1px; margin-left:5px;">
Entire<br />
<asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All" ShowLines="True" ExpandDepth="2">
<Nodes>
<asp:TreeNode Text="Entire">
<asp:TreeNode Text="VM">
<asp:TreeNode Text="MBS1">
</asp:TreeNode>
<asp:TreeNode Text="PF1"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="VM1">
<asp:TreeNode Text="MBS2"></asp:TreeNode>
<asp:TreeNode Text="PF2"></asp:TreeNode>
</asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<p>
<asp:Button ID="btnCreateXML" runat="server" onclick="btnCreateXML_Click"
Text="Create XML" />
<asp:Label ID="lblResult" runat="server" Text="Label"></asp:Label>
</p></div>
<div id="Custom" style="float:left; height:1000; width:2000; border: solid 1px; margin-left:10px;">
Custom <br />
<div id="Manual" style="border:solid 1px; float:left;">
Manual Scan Controls
</div>
<div id="Multiple" style="border:solid 1px; float:left;">
Multiple Scan Controls
<table>
<tr>
<td valign="top" style="width: 165px">
<asp:PlaceHolder ID="phDDLCHK" runat="server"></asp:PlaceHolder>
</td>
<td valign="top">
<asp:Button ID="btn" runat="server" Text="Get Checked" OnClick="btn_Click" />
</td>
<td valign="top">
<asp:Label ID="lblSelectedItem" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
<asp:HiddenField ID="hidList" runat="server" />
</div>
<br />
</div>
code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
initialiseCheckBoxList();
rbtnEntire.Checked = true;
try
{
TreeView1.Attributes.Add("onclick", "javascript: OnTreeClick();");
}
catch(Exception)
{
Response.Write("Error Occured While onTreeClick");
}
}
}
public void initialiseCheckBoxList()
{
CheckBoxList chkBxLst = new CheckBoxList();
chkBxLst.ID = "chkLstItem";
chkBxLst.Attributes.Add("onmouseover", "showdiv()");
DataTable dtListItem = GetListItem();
int rowNo = dtListItem.Rows.Count;
string lstValue = string.Empty;
string lstID = string.Empty;
for (int i = 0; i < rowNo - 1; i++)
{
lstValue = dtListItem.Rows[i]["Value"].ToString();
lstID = dtListItem.Rows[i]["ID"].ToString();
chkBxLst.Items.Add(lstValue);
}
System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
div.ID = "divChkList";
div.Controls.Add(chkBxLst);
div.Style.Add("border", "black 1px solid");
div.Style.Add("width", "160px");
div.Style.Add("height", "130px");
div.Style.Add("overflow", "AUTO");
div.Style.Add("display", "block");
}//end of initialiseCheckBoxList()
protected void btn_Click(object sender, EventArgs e)
{
string x=string.Empty;
string strSelectedItem = "Selected Items ";
CheckBoxList chk = (CheckBoxList)phDDLCHK.FindControl("chkLstItem"); // phDDLCHK is placeholder's ID
for (int i = 0; i < chk.Items.Count; i++)
{
if (chk.Items[i].Selected)
{
if (strSelectedItem.Length == 0)
{
strSelectedItem = strSelectedItem + ":" + chk.Items[i].Text;
}
else
{
strSelectedItem = strSelectedItem + ":" + chk.Items[i].Text;
}
}
}
lblSelectedItem.Text =strSelectedItem;
}
public DataTable GetListItem()
{
DataTable table = new DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Value", typeof(string));
for (int icnt = 0; icnt < 10; icnt++)
{
table.Rows.Add(icnt, "ListItem"+":"+icnt);
}
return table;
}
Problem: When i Select radio button rbtnCustom, It should display div Custom along with the CheckboxList control,which is not happening. When I do not hide div,it is displayed. What can be done to display checkboxList control?
Here is my code, Can any one let me know where I went wrong?
Any help would be appriciated! Thanks!
The reason some of your Javascript isn't working is because you are using the server ID in the client side (Javascript) code.
<asp:RadioButton ID="rbtnCustom" runat="server" Text="Custom"
GroupName="s1"/>
Since the above control is set to runat="server" the ID attribute is setting a sever side control ID, the client ID will be generated. If you don't need access to this control on the server, it might be easier to simply use a 'input' element instead of an asp.net control. The other option would be to set the ClientIDMode="Static" so the client ID is the same as the server ID.
<asp:RadioButton ID="rbtnCustom" runat="server" Text="Custom" ClientIDMode="Static"
GroupName="s1"/>
Use this for any control if you are not setting the ID in the code behind and if you are using the ID in client side Javascript.
EDIT: You are also missing phDDLCHK.Controls.Add(div); at the end of your initialiseCheckBoxList method.
You are also not providing what javascript "OnTreeClick();" is. It is referenced in the code behind. From what I can tell you are only populating the contents of the custom checkboxlist once on the initialiseCheckBoxList.
How to use asp checkbox control as RadioButton
First we create a script like this:
<script type="text/javascript">
function check(sender) {
var chkBox;
var i;
var j;
for (i = 1; i < 6; i++) {
for (j = 1; j < 6; j++) {
if (i != j) {
if (sender.id == "ck" + i) {
chkBox = document.getElementById("ck" + j);
}
else {
chkBox = document.getElementById("ck" + i);
}
if (sender.checked) {
if (chkBox.checked) {
chkBox.checked = false;
}
}
}
}
}
}
</script>
Now we use following code for our ASP CheckBox controls
<div>
<asp:CheckBox ID="ck1" runat="server" Text="P1" onclick="check(this)"/>
<asp:CheckBox ID="ck2" runat="server" Text="P2" onclick="check(this)"/>
<asp:CheckBox ID="ck3" runat="server" Text="P3" onclick="check(this)"/>
<asp:CheckBox ID="ck4" runat="server" Text="P4" onclick="check(this)"/>
<asp:CheckBox ID="ck5" runat="server" Text="P5" onclick="check(this)"/>
</div>
Thank you...

asp.net with jQuery Validation issue

I have 2 textboxs, 2 checkboxs and 2 labels.
first textbox, checkbox, and label related to each other and the same for the rest.
textbox should accept valid phone number based on jquery validation plugin and when the chackbox check the validation rule would change and in both option the error message would disply inside the label.
I have no problem to implement that for one text box but when I add second one will have a problem and only the validation will happen for the second one only.
please look at my code and advice.
<script src="js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
var RegularExpression;
var USAPhone = /^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$/;
var InterPhone = /^\d{9,12}$/;
var errmsg;
function ValidPhoneHome(sender) {
if (sender.checked == true) {
RegularExpression = InterPhone;
errmsg = "Enter 9 to 12 numbers as international number";
}
else {
RegularExpression = USAPhone;
errmsg = "Enter a valid number";
}
jQuery.validator.addMethod("phonehome", function(value, element) {
return this.optional(element) || RegularExpression.test(value);
}, errmsg);
}
function ValidMobileHome(sender) {
if (sender.checked == true) {
RegularExpression = InterPhone;
errmsg = "Enter 9 to 12 numbers as international number";
}
else {
RegularExpression = USAPhone;
errmsg = "Enter a valid number";
}
jQuery.validator.addMethod("mobilephone", function(value, element) {
return this.optional(element) || RegularExpression.test(value);
}, errmsg);
}
$(document).ready(function() {
ValidPhoneHome("#<%= chkIntphoneHome%>");
ValidMobileHome("#<%= chkIntMobileHome%>");
$("#aspnetForm").validate({
rules: {
"<%=txtHomePhone.UniqueID %>": {
phonehome: true
}
}
, errorLabelContainer: "#lblHomePhone",
rules: {
"<%=txtMobileHome.UniqueID %>": {
mobilephone: true
}
}
, errorLabelContainer: "#lblMobileHome"
})
</script>
<asp:CheckBox ID="chkIntphoneHome" runat="server" Text="Internation Code" onclick="ValidPhoneHome(this)" >
<asp:TextBox ID="txtHomePhone" runat="server" ></asp:TextBox>
<label id="lblHomePhone"></label>
<asp:CheckBox ID="chkIntMobileHome" runat="server" Text="Internation Code" onclick="ValidMobileHome(this)" />
<asp:TextBox ID="txtMobileHome" runat="server"></asp:TextBox>
<label id="lblMobileHome"></label>
here is the correct code:
<script src="js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/js.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
ValidPhoneHome("#<%= chkIntphoneHome%>");
ValidMobileHome("#<%= chkIntMobileHome%>");
$("#aspnetForm").validate({
rules: {
"<%=txtHomePhone.UniqueID %>": {
phonehome: true
},
"<%=txtMobileHome.UniqueID %>": {
mobilephone: true
}
},
errorElement: "mydiv",
wrapper: "mydiv", // a wrapper around the error message
errorPlacement: function(error, element) {
offset = element.offset();
error.insertBefore(element)
error.addClass('message'); // add a class to the wrapper
error.css('position', 'absolute');
error.css('left', offset.left + element.outerWidth());
error.css('top', offset.top - (element.height() / 2));
}
});
});
</script>
<div id="mydiv">
<asp:CheckBox ID="chkIntphoneHome" runat="server" Text="Internation Code" Style="position: absolute;
top: 113px; left: 549px;" onclick="ValidPhoneHome(this)"
/>
<asp:TextBox ID="txtHomePhone" runat="server" Style="top: 147px; left: 543px; position: absolute;
height: 22px; width: 128px" ></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="txtHomePhone_FTBE" runat="server"
Enabled="True" FilterType="Numbers" TargetControlID="txtHomePhone">
</cc1:FilteredTextBoxExtender>
<label id="lblHomePhone"
style="position:absolute; top: 175px; left: 451px; width: 351px;"></label>
<asp:CheckBox ID="chkIntMobileHome" runat="server" Style="position: absolute; top: 200px;
left: 535px;" Text="Internation Code" onclick="ValidMobileHome(this)" />
<asp:TextBox ID="txtMobileHome" runat="server" Style="top: 231px; left: 555px; position: absolute;
height: 22px; width: 128px"></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="txtMobileHome_FilteredTextBoxExtender"
runat="server" Enabled="True" FilterType="Numbers"
TargetControlID="txtMobileHome">
</cc1:FilteredTextBoxExtender>
<label id="lblMobileHome" style="top: 254px; left: 449px; position: absolute;
height: 17px; width: 345px"></label>
<asp:CheckBox ID="chkIntFaxHome" runat="server" Style="position: absolute; top: 274px;
left: 567px;" Text="Internation Code" onclick="ValidFaxHome(this)"
/>
<asp:TextBox ID="txtFaxHome" runat="server" Style="top: 294px; left: 569px; position: absolute;
height: 22px; width: 128px"></asp:TextBox>
<label id="lblFaxHome" style="top: 321px; left: 483px; position: absolute;
height: 22px; width: 294px"></label>
<cc1:FilteredTextBoxExtender ID="txtFaxHome_FilteredTextBoxExtender"
runat="server" Enabled="True" FilterType="Numbers" TargetControlID="txtFaxHome">
</cc1:FilteredTextBoxExtender>
</div>

Resources