Sunday, February 16, 2014

vs2010 visual studio 2010 de-attach ie process

if visual studio attach iexplorer.exe process and you need to release simply
open command prompt as administrator
 run the following command
regsvr32.exe "%ProgramFiles(x86)%\Common Files\Microsoft Shared\VS7Debug\msdbg2.dll"
you should close ie first .

Sunday, February 9, 2014

open popup full screen ie firefox chrome

function openFullscreen(page) {
    var yes = 1;
    var no = 0;
    var menubar = no; // The File, Edit, View Menus
    var scrollbars = no; // Horizontal and vertical scrollbars
    var locationbar = no; // The location box with the site URL
    var directories = no; // the "What's New", "What Cool" links
    var resizable = no; // Can the window be resized?
    var statusbar = no; // Status bar (with "Document: Done")
    var toolbar = no; // Back, Forward, Home, Stop toolbar
    if (navigator.appName == "Microsoft Internet Explorer") { // better be ie6 at least
        windowprops = "width=" + (screen.width - 10) + ",height=" + (screen.height - 30) + ",top=0,left=0";
    }
    else { // i.e. if Firefox
        windowprops = "width=" + (screen.width - 5) + ",height=" + (screen.height - 30) + ",top=0,left=0";
    }
    windowprops += (menubar ? ",menubars" : "") +
            (scrollbars ? ",scrollbars" : "") +
            (locationbar ? ",location" : "") +
            (directories ? ",directories" : "") +
            (resizable ? ",resizable" : "") +
            (statusbar ? ",status" : "") +
            (toolbar ? ",toolbar" : "");
    window.open(page, 'fullPopup', windowprops);
    window.opener = top; // this will close opener in ie only (not Firefox)
    // window.opener.print();
    window.close();
}

///////////////////////////////////////////////////
ajax call example

  ScriptManager.RegisterStartupScript(this, typeof(string), "DisplayFile", "openFullscreen('" + Request.QueryString["url"].ToString() + "');", true);

jquery javascript multi line alert

exmaple for multiline alert

//check if radio button checked and return alert
  if ($("#imgTypejpeg2").prop('checked')) {
                alert("jpg checked ");
                if ($("#BW").prop('checked')) {
                    alert(" لا يمكن أرشفة نوع الورق أبيض وأسود " +
                    "مع نوع الوثيقة " +
                          '\n' +
                          "JPEG");
                    return false;
                }
                if ($("#Gray").prop('checked')) {

                    alert(" لا يمكن أرشفة نوع الورق الرمادي " +
                    "مع نوع الوثيقة " +
                          '\n' +
                          "JPEG");
                    return false;
                }
            }


Wednesday, February 5, 2014

rad window open and close using rad button

code sample

protected void RadButton1_Click(object sender, EventArgs e)
{
    //pass the ClientID of the RadWindow to open
    string script = "function f(){Open('"+RadWindow1.ClientID+"'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
}
protected void RadButton2_Click(object sender, EventArgs e)
{
    //pass the ClientID of the RadWindow to close
    string script = "function f(){Close('" + RadWindow1.ClientID + "'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
}


Monday, February 3, 2014

Response.Redirect Page with Complete request vb.net


Public Shared Sub RedirectPage(url As String)


Dim myresponse As HttpResponse = HttpContext.Current.Response

myresponse.Redirect(url,
False)

System.Web.
HttpContext.Current.ApplicationInstance.CompleteRequest()


End Sub

Friday, January 24, 2014

sql_variant check varchar and nvarchar for stored procedure

if you have sql_variant field type and you search for any value in column you will get nothing in your query so you should convert the column and the check value to varchar first or nvarchar to get your search

example

begin
declare @x varchar(10) = 10
SELECT ProfileID FROM Profile WHERE
CONVERT(nvarchar(100),  MR_PATIENT_IF, 126) LIKE @x + '%';
end

SQL SERVER STORED PROCEDURE if else and variable declaration

stored procedure sample for
-how to create if else statement
-how to declare vaiable and set field value for this variable and re-using in procedure


Create PROCEDURE [dbo].[xxx](@ProfileID int,@MR_TYPE INT ,@PATIENT_ID INT)
AS
DECLARE @XPROFILE varchar(200)

if(@MR_TYPE = 0)
BEGIN
SELECT @XPROFILE = ProfileID FROM Profile WHERE MR_PATIENT_IF=@PATIENT_ID
SELECT [Doc_ID],[ProfileID],[Doc_Title]
FROM [Profile_Docs]
 WHERE [ProfileID] = @XPROFILE
order by CreateDate desc;
END
else
BEGIN
SELECT [Doc_ID],[ProfileID],[Doc_Title],[ApplicationID],[Phisical_Name],[Locked],[DocServerID],[Author],[CreatedBy],[CreateDate],[LastupdatedBy],[LastUpdateDate],[Comment],[LastLockedBy],[LastLockedDate],[LastAccessedBy],[LastAccessDate],[published],[PublishDate],[PublishedBy],MR_TYPE
FROM [Profile_Docs]
 WHERE [ProfileID]=@ProfileID
 and (MR_TYPE =@MR_TYPE)
 order by CreateDate desc;
 END;