2016-05-16 37 views
0

我在用戶系統中創建了一個註冊表。我想當用戶點擊我的圖像按鈕,在我的GridView。我將從註冊中心調用url協議並執行Explorer.exe,我將使用網格上的圖像按鈕分配路徑。調用explore.exe與aspx頁面的路徑

我創建的註冊表,低於

Windows Registry Editor Version 5.00 

[HKEY_CLASSES_ROOT\PicPath] 
@="URL: MPath Protocol" 
"URL Protocol"="" 

[HKEY_CLASSES_ROOT\PicPath\shell] 

[HKEY_CLASSES_ROOT\PicPath\shell\open] 

[HKEY_CLASSES_ROOT\PicPath\shell\open\command] 
@="\"C:\\Windows\\explorer.exe\"" 

的問題是,當我添加 @="\"C:\\Windows\\explorer.exe\ " "%1

%1是參數當我通過我的c:\Logs系統啓動任務欄打開無限的探險家。但是,當我使用@="\"C:\\Windows\\explorer.exe\""它的開放探索完美的客戶端系統。但我希望explorer.exe在客戶端系統上打開特定路徑。下面

是我的代碼,我嘗試

protected void grdOrderList_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
    HtmlAnchor a = new HtmlAnchor(); 
    a.HRef = "MPath:OpenForm " + "/root,C:\\Abc"; 
    a.ID = "a1"; 

    System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image(); 
    img.ID = "img1"; 

    img.Visible = true; 
    img.ImageUrl = @"~\images\blue_camera.png"; 
    a.Controls.Add(img); 
    e.Row.Cells[0].Controls.Add(a); 
} 

所以,我怎麼能做到這一點。謝謝你的時間

回答

-1
protected void grdOrderList_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
    HtmlAnchor a = new HtmlAnchor(); 
    a.HRef = "MPath:OpenForm " + "/root,C:\\Abhishek"; 
    a.ID = "a1"; 

    //System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image(); 
    //img.ID = "img1"; 

    //img.Visible = true; 
    //img.ImageUrl = @"~\images\blue_camera.png"; 

    var img = new ImageButton(); 
    img.Click += new ImageClickEventHandler(img_Click); 
    a.Controls.Add(img); 
    e.Row.Cells[0].Controls.Add(a); 
} 

protected void img_Click(object sender, ImageClickEventArgs e) 
{ 
    System.Diagnostics.Process.Start(@"c:\blah.txt"); 
} 
+1

'IExplore'是_Internet_ explorer不是_Windows_ explorer。 –

+0

@davidarnol process.Start將運行在服務器端而不是客戶端 –