client-side

validate asp fileupload control client side

本秂侑毒 提交于 2019-12-04 19:32:44
i have a asp fileupload control on my page. how to validate the selected file on client side. validation rules: 1. file must be jpeg,png,bmp or gif. 2. file size must be within 25 kb and 2 mb. please help. thanks. I Have Tried The Following Code to validate the extension <asp:FileUpload ID="FileUpload2" runat="server"/> <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidateFileUpload" ErrorMessage="Invalid file type. Only .gif, .jpg, .png, .bmp and .jpeg are allowed." ControlToValidate="FileUpload2" ValidationGroup="update"> </asp:CustomValidator> <script

Asp.Net MVC2 Clientside Validation and duplicate ID's problem

给你一囗甜甜゛ 提交于 2019-12-04 19:31:11
I'm using MVC2 with VS2010 I have a view that has two partial views in it: "Login" and "Register" both partial views contains the Email address field i use the following in both partial views: <%: Html.TextBoxFor(model => model.EmailAddress ) %><br /><%: Html.ValidationMessageFor(model => model.EmailAddress) %> if i use both partial views on one page, it ends up having duplicate id's so validation happens across both views (even thopugh they are in seperate forms) how can i go about eliminating this For some controls you can specify the HTML attributes in an overload like this: <%: Html

Frameworks to store data client side

浪子不回头ぞ 提交于 2019-12-04 18:45:38
问题 Are there any frameworks or API to store data client side conveniently, by transferring from database, during user's session ? I'm looking for any framework so that I dont have to, perhaps, care about whether or not the browser support LocalStorage or other storage technologies & I can seamlessly store data!? For my personal use case, I need to be able to pass an unfiltered list of recommended items for user & remove the ones he has added to his lists. I want to store the user's lists client

call partialRefreshGet from SSJS using view.PostScript

▼魔方 西西 提交于 2019-12-04 18:34:36
I have a SSJS running in the BeforePageKoad event. As the last step of the SSJS I want to do a partial refresh. In my script I have this line of code: view.postScript("partialRefreshGet('#{id:panelAll}')") When it executes I get an error that says partialRefreshGet is undeffined. I'm guessing I'm missing something in the format of the call, but as I understand it this should work. Anyone done something like this before. If I leave this code out then do a manual refresh of panelAll from a button everything works correctly. You can't use before view.postScript in the beforePageLoad. Try moving

How do you avoid duplication of validation on the server and client-side?

只愿长相守 提交于 2019-12-04 18:09:54
问题 How do you avoid duplication of validation on the server and client-side? Is there a web programming platform that generates one from the other, so I don't have to keep the two in sync? 回答1: There are frameworks that can generate the client-side validation from serverside validation configuration. Now I don't know what language or frameworks you are using, but maybe this article can be of help: http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/ He's using

What are the valid use cases for client side encryption?

此生再无相见时 提交于 2019-12-04 17:30:21
问题 I just read about the Stanford Javascript Crypto Library (jsfiddle example) which supports SHA256, AES, and other standard encryption schemes entirely in javascript. The library seems very nifty, but I don't know of a reasonable use case for it. As some questions have already pointed out, client side encryption is not a safe way to pass secure data to a server. HTTPS should be used instead. So, are there any projects that would benefit from or require client side encryption? 回答1: Use Case 1

Mongodb client side javascript api

浪尽此生 提交于 2019-12-04 17:03:45
问题 I would like to use mongodb directly from the client-side, using javascript inside my models. I suppose this is possible since on the mongo website there is a javascript realtime console for demo. Does exist a way to use the same api in a normal javascript application without having to write client-server glue code? Thanks 回答1: Looks like the site uses REST-like AJAX interface, but I am certain that it does not access any MongoDB instance directly or even indirectly via some bridge. Thinks

Sharepoint client GetFolderByServerRelativeUrl folder modified date

不羁的心 提交于 2019-12-04 16:59:36
I am trying to retrieve "Modified Date" and "Created Date" for folders when using GetFolderByServerRelativeUrl function, how can i do it? I only able to get relativeUrl and folder Name out of it. below is what i did to retrieve the folder. Please help. FolderCollection folderCollection = rootweb.GetFolderByServerRelativeUrl("/Shared Documents/test2").Folders; spClientContext.Load(folderCollection); foreach (Folder folder in folderCollection) { } By retrieving and accessing the ListItemAllFields property of your Folder s, you can access the created and modified dates as follows: using

How to detect inactive tab and fill it with color

二次信任 提交于 2019-12-04 15:59:22
How can I fill my website with color if tab is inactive? I would like to give screensaver like effect to my site if user move to another window. Can I do that with jQuery? WSkid Here is some basic code to get you going: <script type="text/javascript"> document.onmousemove = resetTimer; window.onload = function() { screenTimer = setTimeout(inactive, 2000); } function inactive(){ // screen saver goes here document.body.style.backgroundColor = "black"; } function resetTimer(e) { // undo screen saver here document.body.style.backgroundColor = "white"; // reset timer clearTimeout(screenTimer);

Removing the jquery/zepto dependency on backbone.router and views

走远了吗. 提交于 2019-12-04 14:14:18
问题 Is there a forked/maintained version of backbone that completely eliminates the need for jquery or zepto to use both the router and views? I wouldn't mind using backbone but there's no way in heck I'd force a jquery dependency on my page just to use it. If a solution doesn't exist can someone post a gist of what needs to be changed exactly? 回答1: If you want Backbone to handle DOM manipulation, DOM events, and AJAX requests, then you'll need another library to do this. It doesn't have to be