Chandra Oemaryadi has written 244 articles

Compare Database Changes using Visual Studio

Kita dapat membandingkan 2 database, lalu menerapkan perbedaan menggunakan fasilitas dari Visual Studio. 1. Buat proyek baru dengan tipe SQL Server Database Project 2. Import database Klik “New Connection”. Di bagian ini memilih database dengan skema baru. 3. Compare dengan skema lama Isi Connection dengan skema lama (yang ingin diubah menggunakan skema baru). 4. Sesuaikan…

Kendo Grid Column Template

Kendo Grid memiliki fitur template. Dapat digunakan untuk kolom biasa maupun kolom command (edit, delete). [code language=”javascript”] <script id="command-template" type="text/x-kendo-template"> # if(Status == ‘@ApprovalNotificationStatus.REJECT’) { # <a class="k-button-icon k-grid-edit" href="javascript:" title="Edit" onclick="editItem(#=Id #)"><span class="glyphicon glyphicon-edit"></span></a> # } # </script> <script type="text/x-kendo-template" id="status-approval"> # if(Status == ‘@ApprovalNotificationStatus.REJECT’) { # <a data-placement="bottom" href="javascript:" class="popover-reject text-danger" data-toggle="popover" data-trigger="focus"…

Upload Files with HTTPWebRequest and Web API

Contoh kode untuk mengirim file menggunakan HTTPWebReqeust. Jika bukan MVC, dapat meng-add Microsoft.Net.Http pada NuGet. Kode di bagian pengiriman file [code language=”csharp”] public string HttpPost(string url, string fileName, byte[] fileByte, string username) { ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications); HttpContent fileNameContent = new StringContent(fileName); HttpContent usernameContent = new StringContent(username == null ? "" : username); HttpContent fileContent…

ASP.NET Web Forms and MVC Bypass Authorization for Single Form or Single Controller using web.config

Jika penanganan authorization menggunakan web.config, authorization dapat di by pass untuk form tertentu / controller tertentu. “Api/File” adalah url untuk memanggil controller (MVC / Web API). “service/FileService.aspx” adalah struktur folder/file ke form. [code language=”xml”] <configuration> <location path="Api/File"> <system.web> <authorization> <allow users="?"></allow> </authorization> </system.web> </location> <location path="service/FileService.aspx"> <system.web> <authorization> <allow users="?"></allow> </authorization> </system.web> </location> <system.web> <authentication…

Kendo Grid Column Template using Javascript

Template pada kendo column dapat menggunakan javascript. Contohnya: [code language=”javascript”] function kendoGridImageTemplate(container, options) { if (container.AbsolutePhoto != null) { var extFile = container.AbsolutePhoto.split(‘.’).pop(); var extensionImage = ["jpg", "jpeg", "png", "bmp"]; if ($.inArray((extFile).toLowerCase(), extensionImage) !== -1) { return ‘<a href="’ + container.AbsolutePhoto + ‘" target="_blank"><img src="’ + container.AbsolutePhoto + ‘" alt="" class="img-responsive"></a>’; } } } //……

Kendo Grid Filter Customize Display Text

Kita dapat mengubah teks pada filter di kendo grid. Contoh tampilan: [code language=”javascript”] columns: [ //… { field: "IsShow", title: "Ditampilkan", width: 120, template: ‘#= (IsShow == true) ? "<span class=\’glyphicon glyphicon-ok\’></span>" : "<span class=\’glyphicon glyphicon-remove\’></span>" #’, filterable: { messages: { isTrue: "Ditampilkan", isFalse: "Disembunyikan" } } }, //… ], [/code]

“Add Area” not Appeared in Visual Studio 2013

Step 1) : Go to your solution explorer and unload the existing ASP.NET project by right clicking and selecting “Unload Project” Step 2) Right Click the Project in solution explorer and select “Edit ….csproj“ Step 3) Go to the Element called “ProjectTypeGuids” and change the content to. [code language=”xml”] <ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> [/code] Save the file and…

DevExpress Upload File

Penanganan upload file seperti di MVC pada webform / devexpress: Semua file disimpan di folder /Uploads/ File diberikan penanda unik dengan GUID [code language=”html”] <dx:LayoutItem Caption="E-corr*" FieldName="attachment" ColSpan="2"> <LayoutItemNestedControlCollection> <dx:LayoutItemNestedControlContainer ID="LayoutItemNestedControlContainer8" runat="server" SupportsDisabledAttribute="True"> <dx:ASPxUploadControl Theme="Metropolis" ID="UploadECorr" Width="20%" ClientInstanceName="UploadECorr" runat="server" UploadMode="Standard" ClientVisible="true" OnFileUploadComplete="UploadECorr_FileUploadComplete"> <AdvancedModeSettings EnableMultiSelect="false" /> <ValidationSettings MaxFileSize="10485760"></ValidationSettings> <ClientSideEvents FilesUploadComplete="onUploadControlFileUploadComplete" /> </dx:ASPxUploadControl> </dx:LayoutItemNestedControlContainer> </LayoutItemNestedControlCollection> </dx:LayoutItem> [/code]…