Friday, March 22, 2013
AJAX - Simple Validation Form
<html>
<head>
<title>JQuery Form Validation</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#form1").validate({
debug: false,
rules: {
name: "required",
dropdown: "required",
email: {
required: true,
email: true
}
},
messages: {
name: "Please enter your good name.",
email: "Please enter your valid email address.",
dropdown: "Please select option from dropdown list.",
},
submitHandler: function(form) {
$.post('nextstep.php', $("#form1").serialize(), function(data) {
$('#result').html(data);
});
}
});
});
</script>
<style>
label.error { width: 250px; display: inline; color: red;}
</style>
</head>
<body>
<form name="form1" id="form1" action="" method="POST">
<label for="name" id="name_label">Name</label>
<input type="text" name="name" id="name" size="30" value=""/>
<br>
<label for="email" id="email_label">Email</label>
<input type="text" name="email" id="email" size="30" value=""/>
<br>
Please Select the City:
<select name="dropdown" id="dropdown">
<option value="">None</option>
<option value="mumbai">Mumbai</option>
<option value="delhi">Delhi</option>
<option value="pune">Pune</option>
</select>
<br>
<input type="submit" name="submit" value="Submit">
</form>
<!-- We will output the results from process.php here -->
<div id="result"><div>
</body>
</html>
Friday, February 15, 2013
PHP - URL Encode and Decode Query String
You can Encrypt the Query String value by using the below coding
$link = "http://www.example.com/?item=".urlencode(base64_encode("user-data"));
You can Decrypt the Query String value by using the below coding
urldecode(base64_decode($_REQUEST['item']));
Tuesday, October 30, 2012
JavaScript - Current Date less than Chosen Date
Example:
var dateField = document.getElementById("txtAppDate").value;
dateField=dateField.replace("-","/");
var d=dateField.replace("-","/");
var stDate = new Date();
var enDate = new Date(Date.parse(d));
var compDate = enDate - stDate;
if(compDate<=0)
{
alert('the entered appointment Date should be greater than todays date');
return false;
}
Sunday, October 7, 2012
SSRS - HTTP 401: Unauthorized With the Reporting Services Web Service
Solution:
You would have to change the reporting services authentication mode to "Basic" from Windows.
Open RSReportServer.config (by default, C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer) and replace
<Authentication>
<AuthenticationTypes>
<RSWindowsNTLM/>
</AuthenticationTypes>
<EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>
with following entry -
<AuthenticationTypes>
<RSWindowsBasic/>
</AuthenticationTypes>
Wednesday, October 3, 2012
SSRS - Adding Date as Optional Parameter with NULL Check Box in SSRS
Chart Visibility if Date is null means set visible=false otherwise visible=true.
=IIF(Isnothing(Parameters!DATE_FROM_PARAM.Value) ,false,true)
SSRS - get Month Name function
Example:1
=MonthName(Month(Fields!datefield.Value))
Example:2
=MonthName(Month(TODAY))
SSRS - Show All Skipped Labels on the X-Axis
My SSRS report does not show all the labels on the horizontal axis. Please see below.

Just about everyone who has worked with category names on the Microsoft Reporting Services or .NET chart has encountered this problem: you databind categorical values from a database, but when it is displayed on the chart, it skips labels on the x-axis, like below:

How Do I Show All Labels on the X-Axis?
The short answer is, set the Interval property on the x-axis to 1:
1 | // Show all labels on the x-axis |
2 | Chart1.ChartAreas[0].AxisX.Interval = 1; |
Issues Created by Solving the X-Axis Label Issue
Showing every x-axis label produces the intended effect of matching every name to a data point, but it also causes clutter if there are too many points or the names are too long. For example, look at what happens when I databind first and last names of each sales person:

Monday, October 1, 2012
ASP.NET - close child window and refresh parent window
Example:1
Example:5
ASP.NET 2.0
Page.ClientScript.RegisterStartUpScript(this.GetType(),"close","<script language=javascript>window.opener.location.reload(true);self.close();</script>");
Example:2
Example:2
ASP.NET 1.X
Page.RegisterStartUpScript("close","<script language=javascript>window.opener.location.reload(true);self.close();</script>");
Example:3
Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.opener.location.reload(true);self.close();</script>"); }
Example:4
protected void btn_submit_Click(object sender, EventArgs e){
protected void btn_submit_Click(object sender, EventArgs e){
string Isok = "";
//*****save data to database code here, if save ok, then set Isok="y", else set Isok="n". ******
if (Isok=="y"){ //close window and refresh parent winsow
Page.ClientScript.RegisterStartUpScript(this.GetType(),"close","<script language=javascript>window.opener.location.reload(true);self.close();</script>");
}
}
Example:5
window.opener.location.href="parentWindow.aspx"
self.close();
Example:6
<script language="JavaScript"> <!-- function refreshParent() { window.opener.location.href = window.opener.location.href; if (window.opener.progressWindow) { window.opener.progressWindow.close() } window.close(); } //--> </script>
Subscribe to:
Posts (Atom)