Current filter:
                                You should refresh the page.
                                  • Hi,

                                    I want via an URL show a picture out of the database. I already can filter a list by url. Now I want to filter the list and display the picture. I think have to put the code into an event after CreateListView is completed.

                                    [C#]
                                    private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e) { string viewId = "TradeCheck_ListView"; if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) { var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), viewId); var criteria = "[KUNDE.KUNDENID] = '" + e.Shortcut["filter"] + "'"; collSource.Criteria.Add("KundenNrFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView(viewId, collSource, true); e.Handled = true; } viewId = "TradeCheckAnhang_DetailView"; if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) { var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), "TradeCheck_ListView"); var criteria = "[FILENAME1] = '" + e.Shortcut["filter"] + "' Or [FILENAME2] = '" + e.Shortcut["filter"] + "'"; collSource.Criteria.Add("FileNameFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView("TradeCheck_ListView", collSource, true); // get fileinformation string fileName = e.Shortcut["filter"]; string extension = Path.GetExtension(fileName); TradeCheckAnhang tradeCheckAnhang = objSpace.GetObjectByKey<TradeCheckAnhang>(fileName); if (tradeCheckAnhang != null) { //Classes.DisplayPicture.DoDisplayPicture(tradeCheckAnhang, fileName, extension); } else { throw new Exception(string.Format("Kein Objekt vorhanden mit Filename = {0}", fileName)); } e.Handled = true; } }

                                    Best Regards

                                    Klaus

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Klaus,

                                In a general case, to show a picture in an XAF view, use the StaticImage class. To show this item along with a list view, use Dashboard View as described in the How to: Display Several Views Side-by-Side article.
                                Try this approach and let me know whether it meets your requirements.

                                Thanks,
                                Andrey

                                Show all comments
                                • Klaus Künzli 1 11.07.2019

                                  Hello Andrey,

                                  Let me explain what I want to do.

                                  I have a XAF WebApplication. When you start the application you will see a list of "Trades" you are allowed to see.

                                  First enhancement I made:

                                  From an external application you can call my "TradingNotes" application an you can position on the "Trades" of a specific client.
                                  I implemented this as follows and it works.

                                  [C#]
                                  private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e) { string viewId = "TradeCheck_ListView"; if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) { var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), viewId); var criteria = "[KUNDE.KUNDENID] = '" + e.Shortcut["filter"] + "'"; collSource.Criteria.Add("KundenNrFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView(viewId, collSource, true); e.Handled = true; } }

                                  You get the list and can select a row and press a button to show the png- or pdf-document in the document viewer.

                                  Now I want to implement an additional case. From an external application you want to show a png- or pdf-document directly in the document viewer.

                                  https://localhost:2222/#ViewID=TradeCheckAnhang_DetailView&ObjectClassName=TradingNotes.Module.BusinessObjects.TradeCheck&filter=DSC_0007.JPG

                                  The filter function works. I see only one record with the information about this "DSC_0007.JPG". But the next step doesn't work to display the document.

                                  I get only the waiting symbol. I think the display of the list is not finished and the system gets another request.

                                  [C#]
                                  public class DisplayTradeCheckPicture : IHttpHandler { public byte[] bytes { get; set; } public string fileName { get; set; } public string contentType { get; set; } public void ProcessRequest(HttpContext context) { context.Response.Buffer = true; context.Response.Charset = ""; if (true) // context.Request.QueryString["download"] == "1") { context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName); } context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.ContentType = contentType; context.Response.BinaryWrite(bytes); context.Response.Flush(); context.Response.End(); } public bool IsReusable { get { return false; } } }

                                  Best Regards

                                  Klaus

                                • Anatol (DevExpress Support) 11.08.2019

                                  Hello Klaus,

                                  The loading indicator is likely shown because of calling the Response.End method. This method cannot be used on callbacks. Check if it helps to remove this method. If it does not, please provide a small sample project demonstrating how images are shown in your project in this scenario.

                                • Klaus Künzli 1 11.09.2019

                                  Hello Anatol,

                                  Attached you find a test application. Start the web application and add some files e.g. *.png, *.pdf. Add the filename in the field filename e.g. Test.pdf.

                                  call the application like this:

                                  http://localhost:2064/Dokument_ListView/&filter=Test.pdf

                                  [C#]
                                  private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e) { string viewId = "Dokument_ListView"; if ((e.Shortcut["ViewID"] == viewId) && e.Shortcut.ContainsKey("filter")) { var objSpace = myapplication.CreateObjectSpace(typeof(Dokument)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(Dokument), viewId); var criteria = "[FILENAME] = '" + e.Shortcut["filter"] + "'"; collSource.Criteria.Add("FileNameFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView(viewId, collSource, true); string fileName = e.Shortcut["filter"]; IList<Dokument> dokumente = objSpace.GetObjects<Dokument>(CriteriaOperator.Parse("[FILENAME] = ?", fileName)); if (dokumente.Count() > 0) { string extension = Path.GetExtension(fileName); DisplayDokument displayDokument = new DisplayDokument(); if (displayDokument != null) { displayDokument.fileName = fileName; displayDokument.contentType = string.Format("image/{0}", extension.Substring(1)); using (var stream = new MemoryStream()) { dokumente[0].File.SaveToStream(stream); displayDokument.bytes = stream.ToArray(); } displayDokument.ProcessRequest(HttpContext.Current); } } else { throw new Exception(string.Format("Kein Objekt vorhanden mit Filename = {0}", fileName)); } e.Handled = true; }

                                  Best Regards
                                  Klaus

                                • Andrey K (DevExpress Support) 11.11.2019

                                  Hello,

                                  I was not able to use the url you provided in the attached example. I had to register the 'filter' key with the WebViewShortcutHelper.RegisterParameterName(String) method and use the following url: http://localhost:2064/Dokument_ListView/?filter=Test.pdf After that, your application suggested downloading a file as expected. Please refer to the attached screencast and the modified project. If you wish to get different behavior, describe it in detail. In case you get different results with the changed project, check it with Chrome Version 78.0.3904.87 (Official Build) (64-bit).

                                  We look forward to your response.

                                  Thanks,
                                  Andrey

                                • Klaus Künzli 1 11.11.2019

                                  Hello,

                                  I register the 'filter' key and my ShowDocument application works the same as you described.

                                  I register the 'filter' key to my real application and try the same.

                                  I get the following error:

                                  Modul   IIS Web Core Benachrichtigung   MapRequestHandler Handler   StaticFile Fehlercode   0x80070002
                                  Angeforderte URL   https://localhost:2222/TradeCheck_ListView/?filter=CCF01072019.pdf Physischer Pfad   C:\app\TradingNotes\TradeCheck_ListView\ Anmeldemethode   Anonym Benutzeranmeldung   Anonym

                                • Klaus Künzli 1 11.11.2019

                                  Hello Andrey,

                                  I use the following code:

                                  [C#]
                                  private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e) { string viewId = "TradeCheck_ListView"; //if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) //{ // var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); // var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), viewId); // var criteria = "[KUNDE.KUNDENID] = '" + e.Shortcut["filter"] + "'"; // collSource.Criteria.Add("KundenNrFilter", CriteriaOperator.Parse(criteria)); // e.View = myapplication.CreateListView(viewId, collSource, true); // e.Handled = true; //} if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) { var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), viewId); var criteria = "[FILENAME1] = '" + e.Shortcut["filter"] + "' Or [FILENAME2] = '" + e.Shortcut["filter"] + "'"; collSource.Criteria.Add("FileNameFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView(viewId, collSource, true); //string fileName = e.Shortcut["filter"]; //TradeCheckAnhang tradeCheckAnhang = objSpace.GetObjectByKey<TradeCheckAnhang>(fileName); //if (tradeCheckAnhang != null) //{ // string extension = Path.GetExtension(fileName); // DisplayTradeCheckPicture displayTradeCheckPicture = new DisplayTradeCheckPicture(); // if (displayTradeCheckPicture != null) // { // displayTradeCheckPicture.fileName = fileName; // displayTradeCheckPicture.contentType = string.Format("image/{0}", extension.Substring(1)); // displayTradeCheckPicture.bytes = tradeCheckAnhang.FILEBLOB; // displayTradeCheckPicture.ProcessRequest(HttpContext.Current); // } //} //else //{ // throw new Exception(string.Format("Kein Objekt vorhanden mit Filename = {0}", fileName)); //} e.Handled = true; }

                                  Best Regards
                                  Klaus

                                • Klaus Künzli 1 11.11.2019

                                  Hello Andrey,

                                  Now I enable the display picture part.

                                  [C#]
                                  private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e) { string viewId = "TradeCheck_ListView"; //if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) //{ // var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); // var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), viewId); // var criteria = "[KUNDE.KUNDENID] = '" + e.Shortcut["filter"] + "'"; // collSource.Criteria.Add("KundenNrFilter", CriteriaOperator.Parse(criteria)); // e.View = myapplication.CreateListView(viewId, collSource, true); // e.Handled = true; //} if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) { var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), viewId); var criteria = "[FILENAME1] = '" + e.Shortcut["filter"] + "' Or [FILENAME2] = '" + e.Shortcut["filter"] + "'"; collSource.Criteria.Add("FileNameFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView(viewId, collSource, true); string fileName = e.Shortcut["filter"]; TradeCheckAnhang tradeCheckAnhang = objSpace.GetObjectByKey<TradeCheckAnhang>(fileName); if (tradeCheckAnhang != null) { string extension = Path.GetExtension(fileName); DisplayTradeCheckPicture displayTradeCheckPicture = new DisplayTradeCheckPicture(); if (displayTradeCheckPicture != null) { displayTradeCheckPicture.fileName = fileName; displayTradeCheckPicture.contentType = string.Format("image/{0}", extension.Substring(1)); displayTradeCheckPicture.bytes = tradeCheckAnhang.FILEBLOB; displayTradeCheckPicture.ProcessRequest(HttpContext.Current); } } else { throw new Exception(string.Format("Kein Objekt vorhanden mit Filename = {0}", fileName)); } e.Handled = true; } }

                                  Attached you see the video ...

                                  Best Regards
                                  Klaus

                                • Gosha (DevExpress Support) 11.12.2019

                                  Hi Klaus,

                                  Your last video stops when the loading indicator is still being shown. So, the final result is not quite clear to me. But, as far as I understand, the issue has been resolved. Would you please clarify this?

                                • Klaus Künzli 1 11.12.2019

                                  Hello Gosha,

                                  In the simple example without authentication it seems to work. I do not understand why this works.

                                  But in the real application it doesn't work !

                                  In video 1 only filter of list is implemented -> this works.

                                  In video 2 filter of list is implemented and display of picture. This is not working only wait symbol for ever.

                                  Best Regards
                                  Klaus

                                • Andrey K (DevExpress Support) 11.13.2019

                                  Hello,

                                  I was not able to start your example as it shows the 'Benutzer ... ist nicht berechtigt TradingNotes zu verwenden! Please consider contacting an administrator about your login details.' exception. In case my project works as you expected, I suggest that you compare it with your application to find the difference that leads to the issue. After that you will be able to either fix this difference or modify my example so that it contains this difference and shows the issue you faced in action. Please note that reviewing users' entire projects is out of our support service scope, so try to include only related code to test projects: A request for simple example programs

                                  Thanks,
                                  Andrey

                                • Klaus Künzli 1 11.13.2019

                                  Hello Andrey,

                                  I do exactly the same in the TradingNotes application. But there it is not working. I expect it has something to do with the different login in the TradingNotes application.

                                  TradingNotes used active directory authentication. I am logged in as user KLAUS. In addition I check in a legacy application if user KLAUS is allowed to use the application.

                                  Here an insert statement. Replace KLAUS, Klaus with your user name in the table MITARBEITER.

                                  Insert into MITARBEITER (USERID,NAME,VERTRAULICHKEIT_CD,BRTG_MUTATION_CD,BRTG_DRUCKEN_CD,BRTG_DRUCKENBELEG_CD,BRTG_UNTERSCHRIFT_CD,BRTG_BANKPOST_CD,BRTG_ROLLE_CD,BRTG_DOKU_CD,BRTG_SALDIEREN_CD,BRTG_ADRESSE_CD,BRTG_KOMMUNIKATION_CD,BRTG_TELEFON_CD,BRTG_TELDEKIS_CD,BRTG_TELFIRMA_CD,BRTG_TELTRADER_CD,BRTG_ALLTABLES_CD,BRTG_CONFIGACCLISTE_CD,BRTG_CONFIGPARLISTE_CD,BRTG_VERSANDAUSARCHIV_CD,BRTG_SERIENBRIEF_CD,BRTG_MANUELLEKTOE_CD,DOWNLOADVERZEICHNIS,SUPERUSER_CD,HOST_USERID,BRTG_ERFASSEN_KTOE_CD,BRTG_DRUCKEN_KTOE_CD,BRTG_WORLDCHECK_CD,ADMINTAB_SPRACHE_CD,BRTG_RISIKOPROFIL_CD,BRTG_BERECHNENRISIKOPROFIL_CD,BRTG_VALIDIEREN_CD,GRUPPEID,BRTG_KAKTENNOTIZEN_CD,BRTG_DRUCKENKAKTENNOTIZEN_CD,BRTG_PAKTENNOTIZEN_CD,BRTG_DRUCKENPAKTENNOTIZEN_CD,LOESCH_CD,LOESCHDATUM,CRTDATUM,CRTUSER,MUTDATUM,MUTUSER,BRTG_HYPERSUITE_CD,BRTG_HYPERSUITE_SAVE_CD,BRTG_HYPERSUITE_PRINT_CD,AKTID,VALIDID,VALID_CD,VALIDUSER,BRTG_DKSCANNINGDECKBLATT_CD,BRTG_SCANARCHIVDOKUMENTE_CD,EMAIL,AML_KONTROLLSTELLE_CD,BRTG_MANUELLEHITS_CD,COMPLIANCE_LEITER_CD,SCAN2CRM_USERID,BRTG_MUT_MARKETINGDATEN_CD,SIGNATUR_SENDEN_CD,DISCLAIMER_SENDEN_CD,SIGNATUR,LOESCHUSER) values ('KLAUS','Klaus Künzli',null,'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N',null,'N','800503','N','N','N',1,'N','N','N',61,'N','N','N','N','N',null,to_date('15.04.19','DD.MM.RR'),'BBS_WDK',to_date('20.08.19','DD.MM.RR'),'BBS_WDK','N','N','N',null,null,'A','BBS_WDK','N','N',null,'N','N','N','KLAUS','N','N','N',null,null);

                                  Best Regards

                                  Klaus

                                • Klaus Künzli 1 11.13.2019

                                  Hello,

                                  I changed the code as follow:

                                  [C#]
                                  private void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e) { string viewId = "TradeCheck_ListView"; if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) { var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheck)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheck), viewId); var criteria = "[KUNDE.KUNDENID] = '" + e.Shortcut["filter"] + "'"; collSource.Criteria.Add("KundenNrFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView(viewId, collSource, true); e.Handled = true; } viewId = "TradeCheckAnhang_ListView"; if (e.Shortcut["ViewID"] == viewId && e.Shortcut.ContainsKey("filter")) { string fileName = e.Shortcut["filter"]; fileName = fileName.Replace("/", ""); var objSpace = myapplication.CreateObjectSpace(typeof(TradeCheckAnhang)); var collSource = myapplication.CreateCollectionSource(objSpace, typeof(TradeCheckAnhang), viewId); var criteria = "[FILENAME] = '" + fileName + "'"; collSource.Criteria.Add("FileNameFilter", CriteriaOperator.Parse(criteria)); e.View = myapplication.CreateListView(viewId, collSource, true); TradeCheckAnhang tradeCheckAnhang = objSpace.GetObjectByKey<TradeCheckAnhang>(fileName); if (tradeCheckAnhang != null) { string extension = Path.GetExtension(fileName); DisplayTradeCheckPicture displayTradeCheckPicture = new DisplayTradeCheckPicture(); if (displayTradeCheckPicture != null) { displayTradeCheckPicture.fileName = fileName; displayTradeCheckPicture.contentType = string.Format("image/{0}", extension.Substring(1)); displayTradeCheckPicture.bytes = tradeCheckAnhang.FILEBLOB; displayTradeCheckPicture.ProcessRequest(HttpContext.Current); } } else { throw new Exception(string.Format("Kein Objekt vorhanden mit Filename = {0}", fileName)); } e.Handled = true; } }

                                  If I debug the application it works in TradingNotes. But if I publish the application and use the link:

                                  https://localhost:2222/TradeCheckAnhang_ListView&filter=IMG_20180314_103401.jpg

                                  I get the following error:

                                  HTTP-Fehler 404.0 - Not Found Die gesuchte Ressource wurde entfernt oder umbenannt, oder sie steht vorübergehend nicht zur Verfügung.

                                  Detaillierte Fehlerinformationen: Modul   IIS Web Core Benachrichtigung   MapRequestHandler Handler   StaticFile Fehlercode   0x80070002
                                  Angeforderte URL   https://localhost:2222/TradeCheckAnhang_ListView?filter=IMG_20180314_103401.jpg Physischer Pfad   C:\app\TradingNotes\TradeCheckAnhang_ListView Anmeldemethode   Anonym Benutzeranmeldung   Anonym

                                • Klaus Künzli 1 11.13.2019

                                  Hello,

                                  I get this error message if I publish my application and run the URL. In Visual Studio debug mode it works !

                                  HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
                                  Most likely causes: • The directory or file specified does not exist on the Web server.
                                  • The URL contains a typographical error.
                                  • A custom filter or module, such as URLScan, restricts access to the file.

                                  Things you can try: • Create the content on the Web server.
                                  • Review the browser URL.
                                  • Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.

                                  Detailed Error Information: Module   IIS Web Core Notification   MapRequestHandler Handler   StaticFile Error Code   0x80070002
                                  Requested URL   https://localhost:2222/TradeCheckAnhang_ListView?filter=IMG_20180314_103401.jpg Physical Path   C:\app\TradingNotes\TradeCheckAnhang_ListView Logon Method   Anonymous Logon User   Anonymous

                                  More Information: This error means that the file or directory does not exist on the server. Create the file or directory and try the request again. View more information »

                                  Best Regards
                                  Klaus

                                • Andrey K (DevExpress Support) 11.14.2019

                                  Hello,

                                  Based on the fact that your application works correctly locally and doesn't after publishing to a server, I assume that the cause of this behavior is the server configuration. I suggest that you refer to the server's documentation or its support to learn how to work with files here.
                                  Let me know in case you face any questions regarding XAF API during this task.

                                  Thanks,
                                  Andrey