webforms

jQuery Validator#remote with ASP.NET WebForms

孤街醉人 提交于 2020-01-14 04:33:07
问题 I'm trying to use the jQuery Validator plugin with WebForms. Here's my jQuery code: $("input[id$=FromZip]").rules('add', { required: true, postalCode: true, remote: { url: "shipping companies.aspx/ValidatePostalCode", type: "POST", contentType: "application/json; charset=utf-8", dataType: 'json', data: "{'postalCodeToValidate': '" + $("input[id$=FromZip]").val() + "'}", dataFilter: function(data) { return (JSON.parse(data)).d; } }, messages: { required: '"From" zip code is required.',

How to authorize roles with ASP.NET Identity in Web Forms?

送分小仙女□ 提交于 2020-01-14 02:34:09
问题 How do I authorize a page to only signed in users that are in a certain role? I am not using MVC, I cannot use the [Authorize(Roles="Admin")] attribute. 回答1: You would use the Web.config to configure access: <configuration> <!-- Allow only Administrators to visit RoleBasedAuthorization.aspx --> <location path="RoleBasedAuthorization.aspx"> <system.web> <authorization> <allow roles="Administrators"/> <deny users="*" /> </authorization> </system.web> </location> </configuration> 来源: https:/

Flask / Python. Get mimetype from uploaded file

本秂侑毒 提交于 2020-01-12 13:44:34
问题 I am using Flask micro-framework 0.6 and Python 2.6 I need to get the mimetype from an uploaded file so I can store it. Here is the relevent Python/Flask code: @app.route('/upload_file', methods=['GET', 'POST']) def upload_file(): if request.method == 'POST': file = request.files['file'] mimetype = #FIXME if file: file.save(os.path.join(UPLOAD_FOLDER, 'File-Name') return redirect(url_for('uploaded_file')) else: return redirect(url_for('upload')) And here is the code for the webpage: <form

How to add Button for downloading excel file in Acumatica

纵饮孤独 提交于 2020-01-11 13:15:32
问题 I'm trying to add button to Users Maintenance and on button's click download excel file, containing some data. I have created PXAction and it's method as above: public PXAction<Users> getUsers; [PXUIField(DisplayName = "Get Users", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select,Visible = true), PXButton(CommitChanges = true)] public IEnumerable GetUsers(PXAdapter adapter) { var accessByRoles = PXSelect<RolesInGraph>.Select(this.Base); var usersByRole = PXSelect

GridView Table 1 related to Table 2

蹲街弑〆低调 提交于 2020-01-11 10:36:48
问题 Sorry I know Title is really confusing but I couldn't figure out what exactly to put down. Basically I created a Grid View which queries database and displays data. It works perfectly, no complain, however what I have right now is, but what I want is, Question: I am not sure how can I do this, can someone just point me out in right direction please ? I think I will going to use nested gridviews. 回答1: Try to change your SELECT Query like below... It will you to get the Expected Result ... SQL

WebForms and ASP.NET MVC co-existence

心不动则不痛 提交于 2020-01-11 09:16:18
问题 I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I've done to make that happen is that I added a namespaces node to the WebForms web.config : <pages styleSheetTheme="Default"> ... <namespaces> <add namespace="System.Web.Mvc"/> <add namespace="System.Web.Mvc.Ajax"/> <add namespace="System.Web.Mvc.Html"/> <add namespace="System.Web.Routing"/> </namespaces> </pages> However, when I try to start the project, I get an error stating: " Compiler Error

Url.Content in asp.net web-forms

白昼怎懂夜的黑 提交于 2020-01-10 17:28:53
问题 I'm trying to do this: <a href="~/Cases/SupRequestSearch.aspx">Search request</a> so I need the ~ to be rendered as http://myserver/app/... in mvc I would do <a href="<%=Url.Content("~/Cases/SupRequestSearch.aspx")%>>Search request</a> is there something similar in asp.net web forms ? 回答1: Try adding runat="server" to your tag. 回答2: As rapadai mentioned above, the equivalent of Url.Content("~/path/to/file.ext") // MVC in webforms is Page.ResolveUrl("~/path/to/file.ext") // Webforms 回答3: Try

Using Active Directory to restrict access to data in webforms app (mainly through populating dropdowns)

你离开我真会死。 提交于 2020-01-07 14:32:09
问题 Please review the scenario and solution I came up with. If it sucks please tell me so. Scenario Need to create an application for submitting & viewing accidents reports that will be used by 50 schools. When submitting a form, an employee will select their school from a dropdown. Likewise when viewing accident reports, the employee will select their school from a dropdown. Some employee's are to be assigned multiple schools. Thus the dropdown needs to be populated with each school they are

Using Active Directory to restrict access to data in webforms app (mainly through populating dropdowns)

北城以北 提交于 2020-01-07 14:31:59
问题 Please review the scenario and solution I came up with. If it sucks please tell me so. Scenario Need to create an application for submitting & viewing accidents reports that will be used by 50 schools. When submitting a form, an employee will select their school from a dropdown. Likewise when viewing accident reports, the employee will select their school from a dropdown. Some employee's are to be assigned multiple schools. Thus the dropdown needs to be populated with each school they are

How to download a file from a modal Dialog that posts back to itself?

流过昼夜 提交于 2020-01-07 07:41:13
问题 ASP.Net Webforms pages are wrapped in a massive form, which restricts other forms on the page because nested forms don't work. This is intentional because in a webforms project, there can only be one form per page, and all of the server/client interaction require it. In order to build a custom form, I put together a modal dialog in this way. In order to allow for proper error messages from the server, my modal dialog has to post back to itself. In order to do this, I followed this trick to