Dot Net Learning Zone Blog

A blog about to learn Dot Net

Archive for March, 2009

Regular Expression for Alphanumeric, float and Max Length in Multi Line

Posted by Rajesh on March 10, 2009

Alphanumeric with White space                                                  :- ^[a-zA-Z0-9 ]+$
For Float  length of integer part 9 and fraction part 4        :-  ([0-9]{1,8}(\.[0-9]{0,4})?|\.[0-9]{1,4})
Max Lenght  in MultiLine TExt BOX                                            :-  “^.{0,255}$”

Posted in Regular Expression | Leave a Comment »

How to get value using SP_EXECUTESQL

Posted by Rajesh on March 10, 2009

DECLARE @Name varchar(50)
DECLARE @Query nvarchar(200)
DECLARE @ParmDefinition NVARCHAR(500)
SET @Query =’Select  @Name=CompanyName  from CompanyDetail’
SET @ParmDefinition = N’@Name varchar(50) OUTPUT’
EXEC SP_EXECUTESQL @Query,@ParmDefinition,@Name=@Name OUTPUT
SELECT @Name

Posted in SQL, SQL Question | Leave a Comment »

How to Pass Value from Parent to Child popup and Child popup to Parent in ASP.net

Posted by Rajesh on March 10, 2009

I have created two pages – Parent.aspx and Child.aspx

Parent.aspx:-

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Parent.aspx.cs” Inherits=”_Default” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title>Untitled Page</title>

<script language=”javascript” type=”text/javascript”>
function OpenPopUP()
{
window.open (‘Child.aspx’,'Child’,'toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=320x,height=350px,top=200px,left=100px’);
return false;
}

</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<table>
<tr>
<td>
Name
</td>
<td>
<asp:TextBox ID=”txtName” runat=”server” Text=”"></asp:TextBox>
</td>
<td>
<asp:Button ID=”btnSearch” runat=”server” Text=”Search” OnClientClick=”OpenPopUP();” />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Child.aspx :-

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Child.aspx.cs” Inherits=”Child” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title>Untitled Page</title>

<script language=”javascript” type=”text/javascript”>
function ValuePatentToChild()
{
var Name =  window.opener.document.forms[0].txtName.value;
var setName =  document.getElementById (‘txtChild’);
setName.value =  Name;

}

function ValueChildToParent()
{
var Name =  document.getElementById (‘txtChild’).value;
window.opener.document.forms[0].txtName.value =  Name;
self.close();
}

</script>

</head>
<body onload=”ValuePatentToChild();”>
<form id=”form1″ runat=”server”>
<div>
<table>
<tr>
<td>
<asp:TextBox ID=”txtChild” runat=”server” Text=”"></asp:TextBox>
</td>
<td>
<asp:Button ID=”btnClose” runat=”server” Text=”Close” OnClientClick=”ValueChildToParent();” />
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Posted in ASP.net2.0, Ajax, Java Script | Leave a Comment »