29.8.10

OnKeyUp Of Textbox inside Ajaxpanel

OnKeyUp Of Textbox inside Ajaxpanelhttp://tastyrazors.com/?p=10

http://forums.asp.net/t/1304375.aspx

http://forums.asp.net/t/1100070.aspx

Disable update Panel of Master Page:
http://forums.asp.net/t/1304375.aspx

21.8.10

Call Server Side function from Client Side Code using PageMethods in ASP.NET AJAX

http://fei29.blogspot.com/2010/02/call-server-side-function-from-client.html

Check gridview header checkbox if all item checkbox are checked


<script language="javascript" type="text/javascript">
<!--

function ChangeCheckBoxState(id, checkState) {
var cb = document.getElementById(id);
if (cb != null)
cb.checked = checkState;
}

function ChangeAllCheckBoxStates(checkState) {
// Toggles through all of the checkboxes defined in the CheckBoxIDs array
// and updates their value to the checkState input parameter
if (CheckBoxIDs != null) {
for (var i = 0; i < CheckBoxIDs.length; i++)
ChangeCheckBoxState(CheckBoxIDs[i], checkState);
}
}

function ChangeHeaderAsNeeded() {
// Whenever a checkbox in the GridView is toggled, we need to
// check the Header checkbox if ALL of the GridView checkboxes are
// checked, and uncheck it otherwise
if (CheckBoxIDs != null) {
// check to see if all other checkboxes are checked
for (var i = 1; i < CheckBoxIDs.length; i++) {
var cb = document.getElementById(CheckBoxIDs[i]);
if (!cb.checked) {
// Whoops, there is an unchecked checkbox, make sure
// that the header checkbox is unchecked
ChangeCheckBoxState(CheckBoxIDs[0], false);
return;
}
}

// If we reach here, ALL GridView checkboxes are checked
ChangeCheckBoxState(CheckBoxIDs[0], true);
}
}

-->
</script>


protected void grdStudents_DataBound(object sender, EventArgs e)
{
if (grdStudents.Rows.Count > 0)
{
CheckBox cbHeader = (CheckBox)grdStudents.HeaderRow.FindControl("HeaderLevelCheckBox");

cbHeader.Attributes["onclick"] = "ChangeAllCheckBoxStates(this.checked);";

List<String> ArrayValues = new List<string>();
ArrayValues.Add(String.Concat("'", cbHeader.ClientID, "'"));

foreach (GridViewRow gvr in grdStudents.Rows)
{
CheckBox cb = (CheckBox)gvr.FindControl("chkSelect");
cb.Attributes["onclick"] = "ChangeHeaderAsNeeded();";
ArrayValues.Add(String.Concat("'", cb.ClientID, "'"));
}

CheckBoxIDsArray.Text = @"<script type=""text/javascript"">" + "\r\n" +
"<!--" + "\r\n" +
String.Concat("var CheckBoxIDs = new Array(", String.Join(",", ArrayValues.ToArray()), ");") + "\r\n" +
"// -->" + "\r\n" +
"</script>";
}
}

HTML fieldset


<tr>
<td class="field" style="width: 582px">
<fieldset style="background-color: #F8F3E3;">
<legend>
<asp:Label ID="lblStudentManagement" runat="server" CssClass="labelTextBold">Management</asp:Label>
</legend>
<table border="0" align="center" cellpadding="0" cellspacing="5" style="width: 582px;
height: 186px">
<tr>
<td style="width: 8%">
&nbsp;
</td>
<td class="txt_color" style="width: 59%" valign="top">
<ul class="listmenu">
<li><a href="Enroll.aspx" target="_self">Enrol</a></li>
<li><a href="List.aspx">List</a></li>

</ul>
</td>
<td valign="top">
<br />
</td>
</tr>
</table>
</fieldset>
</td>
</tr>

8.8.10

find text in all sp of a particular sql database.

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%Reassign%'
AND ROUTINE_TYPE='PROCEDURE'

4.8.10

User not to enter Numberor Decimal in textbox..

By AJAX:
http://forums.asp.net/p/1288474/3802854.aspx
-------------
1.How to check if a textbox contains a number

http://bytes.com/topic/asp-net/insights/654366-how-check-if-textbox-contains-number

2. check user not enter decimal value in textbox

txtCourseFee.Attributes["OnKeyPress"] = "javascript:CheckDecimal(event);";

function CheckDecimal(event) {

var isNS4 = (navigator.appName == "Netscape") ? 1 : 0;

if (!isNS4) {
if (event.keyCode < 46 || event.keyCode > 57)
event.returnValue = false;
}
else {

if (event.which < 46 || event.which > 57) return false;
}
}



3.) If textbox contain No number then Blank it.

txtCourseFee.Attributes["onblur"] = "javascript:isNotNumberThenBlank(" + txtCourseFee.ClientID + ");";

function isNotNumberThenBlank1(obj) {
if (obj.value.search(/[^0-9^.^ ]/) != -1) {
obj.value = "";
obj.focus();
alert('Please enter only numeric value');
return false;

}

return true;
}


4.) Confirmation on button click
btnSave.Attributes["OnClick"] = "javascript:return confirmation();";

function ConfirmSave() {
var retVal = confirm("This will save Student information. Do you want to continue ?");
return retVal;
}

DropDown list Inside GridView

1.DropDown list Inside GridView
http://www.dotnetspider.com/resources/26560-DropDown-List-inside-Gridview.aspx

2.Dropdownlist in gridview footer
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Studio_.NET_2005/Q_23238330.html