Thursday, 5 March 2015

Response.Redirect into new tab

HTML:
 ID="Button1" runat="server" Text="Button"
    onclick="Button1_Click" OnClientClick="document.forms[0].target = '_blank';" />
C#:
        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/YourPage.aspx");
        }
response.redirect to new tab

Wednesday, 10 July 2013

Delete Confirmation Box

<asp:LinkButton ID="lnkDelete" runat="server" 
CommandName="Delete" Text="Delete"
OnClientClick = "return confirm('Are you sure?')" />

Tuesday, 12 March 2013

Hide HyperLink if Database cell is NULL


Visible ='<%# Eval("a") == System.DbNull.Value ? False : True %>'

Wednesday, 6 March 2013

Upload File in VB

VB
Dim spath As String = Server.MapPath("~/foldername/")
Dim sfile As String = FileUpload1.FileName
Dim sfullpath As String = spath & "\" & sfile
Try
  FileUpload1.SaveAs(sfullpath)


Catch ex As Exception
  Label1.Text = "Failed. " & ex.Message
End Try

Tuesday, 5 March 2013

errors : The name ... does not exist in the current

Make sure inherits and class same name

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="office.aspx.cs" Inherits="TEST_office" %>


public partial class TEST_office : System.Web.UI.Page
{
    
}

Thursday, 7 February 2013

SQL : Get Date Only

SQL
DATEADD(dd,0, DATEDIFF(dd, 0, GETDATE()))

SQL 2008
CAST(GETDATE() AS DATE)

Friday, 1 February 2013

IIS 7 Blank Image Problem


Fisrttime when using IIS 7 in Windows 2008 Server i got problem. I can not display all image. After googling I get the solution. The problem is static content not checked yet.