Tuesday, 21 August 2018
Sunday, 19 August 2018
Jquery Check dropdown change
$(function ()
{
$('#ddlReaderMagnification').change(function () {
if ($(this).val() > 0)
{
$('#spnMagnification').css({ "display": "none" });
}
else {
$('#spnMagnification').css({ "display": "inline" });
}
});
});
{
$('#ddlReaderMagnification').change(function () {
if ($(this).val() > 0)
{
$('#spnMagnification').css({ "display": "none" });
}
else {
$('#spnMagnification').css({ "display": "inline" });
}
});
});
Get checked radiobutton value on the basis of name
var rbLensGroup = $('input[name="rbLensGroup"]:checked');
if (rbLensGroup != null && rbLensGroup.val() == "rbReaders")
{
--Do code here
}
if (rbLensGroup != null && rbLensGroup.val() == "rbReaders")
{
--Do code here
}
Remove attribute on the basis of name
$("input[name$='ctl00$ContentPlaceHolderBody$btnBack']").removeAttr("disabled");
Disabled control inside table
$("#tblMain").find('input[type=submit], select, input[type=text], input[type=button], textarea, a').removeAttr('onclick').not('#lbtnReleaseLock').removeAttr('onclick').removeAttr('href').attr({ 'disabled': 'disabled', 'id': '' });
Wednesday, 15 August 2018
how to show empty data text in repeater
======1st Way==========
<FooterTemplate>
<tr id="trEmpty" runat="server" visible="false">
<td colspan = "3" align = "center">
No records found.
</td>
</tr>
</FooterTemplate>
======Code Behind======
if (dt.Rows.Count == 0)
{
Control FooterTemplate = rptCustomers.Controls[rptCustomers.Controls.Count - 1].Controls[0];
FooterTemplate.FindControl("trEmpty").Visible = true;
}
======2nd Way========
<FooterTemplate>
<asp:Label ID="defaultItem" runat="server"
Visible='<%# YourRepeater.Items.Count == 0 %>' Text="No items found" />
</FooterTemplate>
======3rd Way========
<FooterTemplate>
<asp:Label ID="lblEmptyData" runat="server" Visible='<%# ((Repeater)Container.NamingContainer).Items.Count == 0 %>' Text="No items found" />
</FooterTemplate>
<FooterTemplate>
<tr id="trEmpty" runat="server" visible="false">
<td colspan = "3" align = "center">
No records found.
</td>
</tr>
</FooterTemplate>
======Code Behind======
if (dt.Rows.Count == 0)
{
Control FooterTemplate = rptCustomers.Controls[rptCustomers.Controls.Count - 1].Controls[0];
FooterTemplate.FindControl("trEmpty").Visible = true;
}
======2nd Way========
<FooterTemplate>
<asp:Label ID="defaultItem" runat="server"
Visible='<%# YourRepeater.Items.Count == 0 %>' Text="No items found" />
</FooterTemplate>
======3rd Way========
<FooterTemplate>
<asp:Label ID="lblEmptyData" runat="server" Visible='<%# ((Repeater)Container.NamingContainer).Items.Count == 0 %>' Text="No items found" />
</FooterTemplate>
Monday, 13 August 2018
How to disable all controls on page in asp.net
We have several ways to do this:
Jquery
a) Specific control type
$('input[type=submit], select, input[type=text], input[type=button], input[type=checkbox], input[type=radio], textarea, a').not('#ContentPlaceHolderMiddle_btnTEsting').removeAttr('onclick').removeAttr('href').attr({ 'disabled': 'disabled' });
b) All Controls
$("*").not('#ContentPlaceHolderMiddle_btnTEsting').removeAttr('onclick').removeAttr("href").attr({ "disabled": "disabled" });
Javascript
var vControl = document.forms[0].elements;
var vControlAnchor = document.forms[0].getElementsByTagName('a');
for (j = 0; j < vControlAnchor.length; j++) {
vControlAnchor[j].removeAttribute('href');
//document.forms[0].getElementsByTagName('a')[0].removeAttribute('href');
}
for(i = 0; i< vControl.length; i++)
{
vControl[i].disabled = true;
}
Jquery
a) Specific control type
$('input[type=submit], select, input[type=text], input[type=button], input[type=checkbox], input[type=radio], textarea, a').not('#ContentPlaceHolderMiddle_btnTEsting').removeAttr('onclick').removeAttr('href').attr({ 'disabled': 'disabled' });
b) All Controls
$("*").not('#ContentPlaceHolderMiddle_btnTEsting').removeAttr('onclick').removeAttr("href").attr({ "disabled": "disabled" });
Javascript
var vControl = document.forms[0].elements;
var vControlAnchor = document.forms[0].getElementsByTagName('a');
for (j = 0; j < vControlAnchor.length; j++) {
vControlAnchor[j].removeAttribute('href');
//document.forms[0].getElementsByTagName('a')[0].removeAttribute('href');
}
for(i = 0; i< vControl.length; i++)
{
vControl[i].disabled = true;
}
Subscribe to:
Posts (Atom)

