Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 28, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: snippet process.start not showing file??
chez
Posts: 44
 
snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Nov 11 10:26 AM
fiogf49gjkf0d

on slx v7.5.3 web
i have a grid and created select column, on rowselectchange property i have added a c# snippet which i what to open a file(xml or doc anything or directory)
the following code runs when debug slx via visual studio but not when run saleslogix itself??


hpath = "C:\documents\image.jpg"  or "C:\documents\myfiles"


if (hpath != null)
    {
 if (System.IO.File.Exists(hpath))
 {


            string myPath = hpath;   //@"C:\documents\test file.txt";
            System.Diagnostics.Process prc = new System.Diagnostics.Process();
            prc.StartInfo.FileName = myPath;
            prc.Start();   
  }
  else
  {//open directory
   System.Diagnostics.Process.Start(hpath);
     }
    }

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Nov 11 10:59 AM
fiogf49gjkf0d

Process.Start runs on the server. Not on the client. What your code is trying to do is open a file on the webserver (which is not where the user is). You cannot use Process.Start in a web application. In order to open the file for the user, you need to do a Response.BinaryWrite (this is one of several choices). See http://www.dotnetperls.com/response-binarywrite-aspnet - what this will do is trigger a file download to the user. They'll get the standard file download prompt in their browser and can then do whatever they want with the file.


Make sense?

[Reply][Quote]
chez
Posts: 44
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Nov 11 3:53 AM
fiogf49gjkf0d

sorry not fluent in code,


need to open a txt,doc,pdf or jpeg file


will know path as store in grid -but hardcided for now


tried:


  string path = @"C:\\documents\\test file.txt";


byte[] byteArray = System.IO.File.ReadAllBytes(path);


Response.BinaryWrite(byteArray);


Response.ContentType = "application/octet-stream";


but get error: the message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(),response filters, HttpModules or server trace is enabled. Details:error parsing near 'this is a test file4'.

[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Nov 11 5:46 AM
fiogf49gjkf0d

That sounds like an AJAX error, the grid is in an UpdatePanel and it wont let you run this kind of operation I believe. Register your button (or whatever is calling your code) as a PostBackTrigger.

[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Nov 11 5:51 AM
fiogf49gjkf0d

To add to the above I think you need a "full" postback, not just an AJAX panel update. This should help:


 


http://forums.asp.net/p/1197145/2074699.aspx#2074699

[Reply][Quote]
chez
Posts: 44
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Nov 11 7:43 AM
fiogf49gjkf0d

is the post back code i can add into the snippet, is so how?


or is there a property i need to change on the grid


(grid is just on a tab under the account, with "select" as column text that runs this snippet)

[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 11 1:37 AM
fiogf49gjkf0d
You need to add the code to register the postback control (in this case your select column in the grid) in a page load event. Turn your quick form into a custom smart part instead and just treat it like standard asp.net page. It will make your life much easier.
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 11 1:38 AM
fiogf49gjkf0d
And take a look at the code in the attachments tab. That does pretty much what you want anyway.
[Reply][Quote]
chez
Posts: 44
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Nov 11 5:45 AM
fiogf49gjkf0d

how do add a postback in the page load event for a select column?


totally befuzzled on this for some reason!

[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: snippet process.start not showing file??Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Nov 11 6:31 AM
fiogf49gjkf0d

This should help:


 


http://stackoverflow.com/questions/1289958/how-to-configure-a-gridview-commandfield-to-trigger-full-page-update-in-updatepa


 


It's in VB.net but should give you the idea. It does it in RowDataBound as opposed to Page_Load which is fine. you will need to convert your quickform (if is one) into a custom smartpart to add the RowDataBound though.


Alternatively you could have a separate aspx page that handles the file generation/sending to client, and in your grid just hyperlink (target="_blank") and open the aspx page and pass in any params you need to in the query string.

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/28/2025 5:49:20 PM