Hello,

Please find below code that can help you to solve your problem of opening page in new tab of browser.

use this below code in the code behind

btnPrint.Attributes.Add ("OnClick","openwindow()");

and use this code in the head tag

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

function openwindow()
{
window.open ("PrintReport.aspx",'','width=1000px,height=600px,menubar=yes,scrollbars=yes,
left=0,top=0');
}
</script>


Thankyou,
Rajesh Singh
Asp.Net Developer
Indianic Infotech ltd (India)
rajesh@indianic.com

Hello,

This is one of the important validation that you need to take care, when user enter's data in form.

Most of the time user tries to enters his/her birth date higher than today's date, so this is poor validation.

Please find few line code below that will help you comparing users birth date which should be lower than today's date.

//---------------code of code behind -------------------

If Trim(txtBirthDate.Text) = "" Then
Else
Dim textboxdate As Date = Convert.ToDateTime(txtBirthDate.Text).Date
Dim todaysdate As Date = DateTime.Now.Date
If textboxdate >= todaysdate Then
datelabel.Visible = True
datelabel.Text = "Birth date must Not be greater than today's Date"
flag = False
End If
End If

//------------------ code ends -------------------------


//---------------code for front end --------------------

<td>
<div id="datediv">
<asp:Label ID="datelabel" runat="server"></asp:Label>
</div>
</td>>

//-------------------code ends -------------------------

Hope this post will help you,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech ltd (India)
rajesh@indianic.com

Different Types of Methods in VB.NET

Posted by rajesh Singh | 3:10 PM

There are two types of methods in VB .NET:

those that return a value (Functions)
and those that do not return a value (Sub Procedures)

Sub Procedures ( do not return a value )
--------------------
Sub Main()
'sub procedure Main() is called by default
Display()
'sub procedure display() which we are creating
End Sub

Sub Display()
MsgBox("Using Sub Procedures")
'executing sub procedure Display()
End Sub

Functions ( return a value )
-------------
Sub Main()
Write("Sum is" & " " & Add())
'calling the function
End Sub

Public Function Add() As Integer
'declaring a function add
Dim i, j As Integer
'declaring two integers and assigning values to them
i = 10
j = 20
Return (i + j)
'performing the sum of two integers and returning it's value
End Function


Hope this post will help you,
Rajesh Singh
Asp.Net Developer
Indianic Infotech Ltd (India)
Rajesh@indianic.com

C# Code to Delete All file from the Folder

Posted by rajesh Singh | 6:38 PM

You can Copy below code and paste in your code file.

//-----------------------Code Start here----------------------------

protected void CleanImageFolder()
{
string imgFolder = Server.MapPath("~/lab/maskemail/img/");
string[] imgList = Directory.GetFiles(imgFolder, "*.jpg");
foreach (string img in imgList)
{
FileInfo imgInfo = new FileInfo(img);
if (imgInfo.LastWriteTime < DateTime.Now.AddMinutes(-3))
{
imgInfo.Delete();
}
}
}

//-----------------------Code End here----------------------------

Hope this post will help you,
Rajesh Singh
Asp.Net Developer
Indianic Infotech Ltd (India)
Rajesh@indianic.com

Contact Us

Posted by rajesh Singh | 5:51 PM









Name
E-mail Address: *
Phone
Purpose of Contact *
Message

* Required

In below code you can find, How to implement update query using Stored Procedure.


IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID=OBJECT_ID('UpdateProjectDetail'))
DROP PROCEDURE UpdateProjectDetail
GO

CREATE PROCEDURE UpdateProjectDetail
(
@piProjectID INT,
@piCustomerID INT,
@psProjectTitle VARCHAR(100),
@psProjectDescription VARCHAR(200),
@psProjectCategory INT,
@pdStartDate DATETIME,
@pdEndDate DATETIME,
@psStatus VARCHAR(10),
@piHours INT,
@piCreatedBy INT
)
AS
BEGIN
UPDATE projects SET

CustomerID=@piCustomerID,

ProjectTitle=@psProjectTitle,
ProjectDescription=@psProjectDescription,
ProjectCategory=@psProjectCategory,
StartDate=@pdStartDate,
EndDate=@pdEndDate,
Status=@psStatus,
Hours=@piHours,
CreatedBy=@piCreatedBy,
CreatedDate=GETDATE()

WHERE
ProjectID=@piProjectID
END
GO


Hope this post will help you,
Rajesh Singh
Asp.Net Developer
Indianic Infotech Ltd (India)
Rajesh@indianic.com

You can find in below code, How "if condition" is implemented.

IF EXISTS (SELECT * FROM SYSOBJECTS WHERE OBJECT_ID=('GetProjectList'))
DROP GetProjectList
GO

CREATE PROCEDURE GetProjectList
(
@psStatus VARCHAR(20)
)
AS
BEGIN
IF @psStatus=' '
BEGIN
SELECT PRO.*,CUST.CustomerName,CAT.CategoryName FROM Projects PRO,CUSTOMER CUST,PROJECTCATEGORY CAT WHERE PRO.CustomerID=CUST.CustomerID AND CAT.CategoryID=PRO.ProjectCategory
END
ELSE
BEGIN
IF @psStatus='Open'
SELECT PRO.*,CUST.CustomerName,CAT.CategoryName FROM Projects PRO,CUSTOMER CUST,PROJECTCATEGORY CAT Where Status='Open' AND PRO.CustomerID=CUST.CustomerID AND CAT.CategoryID=PRO.ProjectCategory
ELSE
SELECT PRO.*,CUST.CustomerName,CAT.CategoryName FROM Projects PRO,CUSTOMER CUST,PROJECTCATEGORY CAT Where Status='Close' AND PRO.CustomerID=CUST.CustomerID AND CAT.CategoryID=PRO.ProjectCategory
END
END
GO

Hope this post will help you,
Rajesh Singh
Asp.Net Developer
Indianic Infotech Ltd (India)
Rajesh@indianic.com