Base solution for your next web application

Activities of "AstarIT"

Question

Does anyone has a plug in (free) document viewer that works with asp.net zero? at least 5MB viewer I been trying with google docs viewer but it does not embed the viewer in the page, instead opend other page and then if I close the page the app closees All help will be really appreciated. Thank you

That works very well, Now what about ot save the files in a folder intead the database? any idea will be grantly appreciated. Thnak you

Can you share the code, I have the same situation here. I try to upload files to my server. All help will be really appreciated. Thank you

Thank you that works the first time then I go the browser disconnection using DEVTOOLS. Crome was disconecting so I did a little research and I found out that there is an issue with Crome and instead use Crome Canary which I did. Now it working fine however I am still need to use CROME. Have you enconter such a problem,if so let us know. Thank you.

This is the code $(document).ready(function () { debugger; var country = $("#CountryId"); var state = $("#StateId"); state.prop("disabled", true);

country.change(function () {
    if ($(this).val() == "0") {
        state.prop("disabled", true);
        state.val("0");
        console.log($(this).val());
    }
    else {
      //  debugger;
        abp.ajax({

            url: abp.appPath + "api/services/app/TenantExtendeds/GetAllStates?Id=" + $(this).val(),
            method: "Get",
            dataType: "Json",
            data: JSON.stringify(url),
            success: function (data) {
                state.prop("disabled", false);
                state.empty();

                $(data).each(function (index, item) {
                    //state.append($('<option/>', { value: item.id, text: item.Name }));
                    state.append("<option value='" + item.id + "'>" + item.name + "</option>")
                });
                
            },
            error: function (jqXHR, textStatus, errorThrown) {
                console.log(textStatus, errorThrown);
                console.log(data);
            }

        });
                   
    }
});

});

Thank you have a good day. Greetings.

I have big issues here with the abp.ajax. I cannot find documentation about it. just the one is on the asp.net zero site. second I am using it and I get this following errors //Get States select controls added by Cesar [AbpAuthorize(AppPermissions.Pages_Administration_TenantExtendeds)] [HttpPost] [WrapResult(WrapOnSuccess = false, WrapOnError = false)] public List<NameValue<string>> GetAllStates(int Id) { var states = _stateRepository.GetAll().ToList().Where(m => m.CountryId == Id); var stateslist = new List<NameValue<string>>(); foreach (var item in states) { stateslist.Add(new NameValue { Name = item.Name, Value = item.Id.ToString() });

		}

		return  stateslist.ToList();

	}
	// end States by Cesar

This is the Ajax // Country State $(document).ready(function () { debugger; var country = $("#CountryId"); var state = $("#StateId"); state.prop("disabled", true);

country.change(function () {
    if ($(this).val() == "0") {
        state.prop("disabled", true);
        state.val("0");
        console.log($(this).val());
    }
    else {
        debugger;
        abp.ajax({
            
            url: abp.appPath + "api/services/app/TenantExtendeds/GetAllStates?Id=" + $(this).val(),
            method: "Post",
            
            success: function (data) {
                state.prop("disabled", false);
                state.empty();
                
                $(data).each(function (index, item) {
                    state.append($('&lt;option/&gt;', { value: item.id, text: item.Name }));

                });
            }
        });
    }
});

});

I have the following errors Missing type map configuration or unsupported mapping

AutoMapper.AutoMapperMappingException HResult=0x80131500 Message=Missing type map configuration or unsupported mapping. Source=<Cannot evaluate the exception source> StackTrace: <Cannot evaluate the exception stack trace>

"Error detail not sent by server." "You should be authenticated (sign in) in order to perform this operation." "You are not authenticated!" "You are not allowed to perform this operation." "The resource requested could not found on the server."

Any help here will be really appreciated Thank you

I got the solution!!!! Solution:

	public List&lt;NameValue&lt;string&gt;> GetAllBusinessType3(string searchTerm)
	{
		var businesstype = _businesstypeRepository.GetAll().ToList();
		var businesstypelist = new List&lt;NameValue&lt;string&gt;>();
		foreach (var item in businesstype)
		{
			businesstypelist.Add(new NameValue { Name = item.Name, Value = item.Id.ToString() });

		}

		return businesstypelist.Where(c => c.Name.ToLower().Contains(searchTerm.ToLower())).ToList();

	}

Works like a charm.

This are the result form the samples of Metronics, Under DEMOUICOMPONENTS

{result: Array(12), targetUrl: null, success: true, error: null, unAuthorizedRequest: false, …} result: Array(12) 0: {name: "United States of America", value: "2"} 1: {name: "Russian Federation", value: "3"} 2: {name: "France", value: "4"} 3: {name: "Spain", value: "5"} 4: {name: "Germany", value: "6"} 5: {name: "Netherlands", value: "7"} 6: {name: "China", value: "8"} 7: {name: "Italy", value: "9"} 8: {name: "Switzerland", value: "10"} 9: {name: "South Africa", value: "11"} 10: {name: "Brazil", value: "13"} 11: {name: "India", value: "14"} length: 12 proto: Array(0) targetUrl: null success: true error: null unAuthorizedRequest: false __abp: true proto: Object

THIS IS WHAT I GOT USING MY METHOD 0: {key: "Contractor", value: "2"} 1: {key: "Sub-Contractor", value: "3"} 2: {key: "Exclusive Member", value: "5"}

THIS IS METRONICS 0: {name: "United States of America", value: "2"} 1: {name: "Russian Federation", value: "3"} 2: {name: "France", value: "4"} 3: {name: "Spain", value: "5"}

As we can see the only difference here is the Key... one is called key and the other one is called name.

$(".kt-select2").select2({ placeholder: 'Select', ajax: { url: abp.appPath + "api/services/app/TenantExtendeds/GetAllBusinessType", dataType: 'json', delay: 250, data: function (params) { return { searchTerm: params.term, // search term page: params.page }; },

        processResults: function (data, params) {
            params.page = params.page || 1;
            console.log(data);
            return {
                results: $.map(data.result, function (item) {
                    return {
                        text: item.name,
                        id: item.value
                       
                    }
                    
                }),
                pagination: {
                    more: (params.page * 30) < data.result.length
                }
                
            };
            
        },
        cache: true
       
    },
    minimumInputLength: 1,
    language: abp.localization.currentCulture.name
    
    
});

That is Metronic Function on Single Selcect and Multiple Select, Using Select2. As you can see in my results data is passed. bu does not show the list of selected data in Metronics controls.

This are the values that I got from debuging data using my approach {result: Array(3), targetUrl: null, success: true, error: null, unAuthorizedRequest: false, …} result: Array(3) 0: {key: "Contractor", value: "2"} 1: {key: "Sub-Contractor", value: "3"} 2: {key: "Exclusive Member", value: "5"} length: 3__proto__: Array(0)targetUrl: nullsuccess: trueerror: nullunAuthorizedRequest: false__abp: true__proto__: Object

result: Array(2), targetUrl: null, success: true, error: null, unAuthorizedRequest: false, …} result: Array(2) 0: {key: "Sub-Contractor", value: "3"} 1: {key: "Exclusive Member", value: "5"} length: 2__proto__: Array(0)targetUrl: nullsuccess: trueerror: nullunAuthorizedRequest: false__abp: true__proto__: Object

In the approach that you suggesting return businesstype.Select(p => new NameValue<BusinessType>(p.Name, p)).ToList();

Why do I have to write here my "BusinessType" Entity here ?

Showing 31 to 40 of 44 entries