Grid View Javascript Validation

To Add Javasvript in Gridview For  Validation
Add Javascript Code in GridView RowDatabound Event
and call tha tfunction From Code

For GridView RowDatabound Add Javascript Code

if (e.Row.RowType == DataControlRowType.DataRow)

TextBox txtRate = (TextBox)e.Row.FindControl(“txtRate”);
txtRate.Attributes.Add(“onblur”, “return ValidateCalculation(‘”+txtRate.ClientID+”‘)”);

And in Aspx Page Add Following Javascript

<script type=”text/javascript”>
function ValidateCalculation(i)

Advertisement How to pass Value From Child Page to Parent Page

-For Parent Page Open Child Window

protected void Page_Load(object sender, EventArgs e)
string openWindow = @”‘Child.aspx’)”;
this.Button1.Attributes.Add(“onclick”, openWindow);

For Child Page

this.LinkButton1.Attributes.Add(“onclick”, “PassValues()”);

Write this Code for Javascript in Child Page

This code will pass value in Window.opener Form With Given Text Box

<script language=javascript>
function PassValues()
var txtValue = document.getElementById(“<%=TextBox1.ClientID%>”).value
window.opener.form1.txtUserName.value = txtValue;
</script> Basic

Gridview Column date Format
DataFormatString=”{0:MM/dd/yyyy}”  HtmlEncode=”False”
Date in “MM/dd/yyyy” Format
Check Query String is Null
if (!String.IsNullOrEmpty(Request.QueryString[“Id”]))