asp.net

Javascript: Lazy Load Images In Horizontal Div?

I have a div that has a bunch of thumbnails showing horizontally (with a horizontal scrollbar). Is there a way to lazy load these thumbnails and only show them once the user horizontally scrolls to their position? All the examples I've seen check the browser window, not a div. This is for contest entries so sometimes there are hundreds ...

Simple Facebook Connect Demo in ASP.NET

Does anyone have a simple and successful demo implementation of facebook connect in an asp.net application. I am developing an asp.net web application and want facebook connect to be the primary method for logging in. ...

Preventing XSS (Cross-site Scripting)

Let's say I have a simple ASP.NET MVC blog application and I want to allow readers to add comments to a blog post. If I want to prevent any type of XSS shenanigans, I could HTML encode all comments so that they become harmless when rendered. However, what if I wanted to some basic functionality like hyperlinks, bolding, italics, etc? ...

Switched to ASP.NET 3.5, DropDownList doesn't remember dynamically added items

I have a site that uses a couple DropDownLists that are databound. I was also doing the traditional if (!IsPostBack) {list.Databind();} and relied on viewstate to keep the lists filled during a post back. I recently converted the site to ASP.NET 3.5 and noticed that the lists are empty during postback (as if ViewState is disabled). I did...

determing the height in pixels of a gridview on an asp.net page at runtime?

Anyone know if it possible at run-time to know how many pixels high an asp.net gridview is? I have a gridview on the left of my page. On the right side, I populate with random images that vary in height and I would like to (as close as possible) match the total height of the gridview with the sum total heights of the pictures on the rig...

How do I write a User Defined Function?

I would like to write this as a user defined function: private double Score(Story s){ DateTime now = DateTime.Now; TimeSpan elapsed = now.Subtract(s.PostedOn); double daysAgo = elapsed.TotalDays; return s.Votes.Count + s.Comments....

ASP.net Toolkit Masked Edit Control With 99:99 Time Mask

Hi, I am trying to use the asp.net ajax toolkit masked edit control to take an hour/minute input with the mask 99:99 and the masktype="time" property set. However it doesn't seem to do any time validation client or server side.... it allows me to input any numbers like 88:77 which isn't a valid time. Is this a bug in the control or is...

In .NET MVC, can we keep the CSS inside the Views folder?

I am working with ASP.Net MVC. When I keep the css inside the Views folder, its not loading the CSS. Can anybody help me regarding this issue? ...

GridView paging on custom collecton

I am using Paging on a GridView that is tied to a List. But i use this code, it does not work. What is the correct way. i am not using objectdatasrc protected void myGV_PageIndexChanging(object sender, GridViewPageEventArgs e) { List<Employee> p = ReturnEmplColl(); GridView1.DataSource = p.Paging(1, e.NewPageIndex); G...

C# - Best way to change CSS Classes from code

It's easy to set CSSClass in the codebehind, but this runs the risk of overwriting existing classes. I need to set certain elements to ReadOnly = true; and i'd like to apply a style as a visual cue that the item cannot be altered... easy enough .CSSClass += " ReadOnlyStyle"; But then I equally need to change the same element to ReadO...

How can I use aspnet_compiler from a bat file?

I need to execute aspnet_compiler from a bat file that I maintain to automate the publishing of a ASP.NET application from within CruiseControl.NET. aspnet_compiler runs fine if I manually open the Visual Studio Command Prompt, but doesn't run if I open a normal cmd.exe. What steps should I take to make aspnet_compiler accessible throu...

Encoded character is used instead the correct one

I have a little problem and I'm hopping that you can help me solve this annoying issue. I need to use an iFrame in an administration panel to let users use the selection service, and in the HTML I have: <iframe scrolling="yes" runat="server" title="Par Selection" id="iFrame" frameborder="0" enableviewstate="true" width="100%" heigh...

regular expression for no blank space b/w text

Please tell me how to check regular expression for no blank space b/w text. ...

Accessing ListBox values at Server after modifying it via Javascript ASP.Net

I have a listBox whose values I am manipulating by javascript for e.g adding a new Item to list. Now when I am trying to access this listBox from Server its only showing me the values that were originally part of ListBox at PageLoad. The newly added items are not accessible. How can I access those new added Items at server ...

How do I do pagination in ASP.NET MVC?

What is the most preferred and easiest way to do pagination in ASP.NET MVC? I.e. what is the easiest way to break up a list into several browsable pages. As an example lets say I get a list of elements from a database/gateway/repository like this: public ActionResult ListMyItems() { List<Item> list = ItemDB.GetListOfItems(); V...

How do I look at remote processes in C#?

I want to know if a process is running in the current machine as a part of my application ,but my application is deployed in another machine. I'm using System.Diagnostics.Getprocessbyname but it looks for processes on the machine the application is deployed to. I want to know whether the process is running on my machine. Is there a way...

LINQ Sorting

Hello, I am sorting a GridView bind to a ananymous type. protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { List<object> lb = (List<object>)ReturnAnony(); // Not working // ?? What to write here } object ReturnAnony() { var anony = // I create the ananymous type and return return anony; } ...

Global resource vs. Local resource in ASP.NET

We use resx files to localize our web applications. We usually create local resx files (that map to a specific page) when only one page uses a certain phrase, and a global resx file when more than one page needs the phrase. But the good thing about global resx files is that they are a class, and you can call the phrases like you call ...

dynamic property access for generated LINQ Classes

How can I access dynamically properties from a generated LINQ class ? Cause I would like to be able to customize the displayed table columns where Partner is the LINQ Class generated from a SQL Server Database Table. <table class="grid"> <thead> <tr> <% foreach (Column c in (IEnumerable)ViewData["columns"]) { %> <th><%= ...

Binding to ASP.NET GridView

I have the following code: var emp = new List<Employee> { new Employee{ID=1, EmpFname="matt", EmpLName="Cook"}, new Employee{ID=2, EmpFname="mary", EmpLname="John"} }; How do I sort emp by EmpLName and bind it to a GridView? How do I specify asc or desc? ...