asp.net

Best practice for saving and recalling selected checkboxes on an asp.net page

I am looking for ideas on the best way to persist an array of values from one web session to the next. I will be populating a Checkbox list and would like to persist the last set of selected checkboxes to the next session. (this is meant to save time for the user since they will likely always select the same subset of checkboxes.) I wil...

How do I ensure that all clients can correctly parse a database DateTime string?

I got a Windows application, used on hundreds of computers. It gets dates from my Sql Server as string and converts this string to datetime format to calculate some date time difference. Sometimes on some system, we get error while converting string to Date. "String was not recognized as a valid DateTime". Every computer's Windows Dat...

Regex match issue

With the following regex, it is not matching -lp[number] public static Regex lPageID = new Regex(@"\-lp\d+\.", RegexOptions.Compiled | RegexOptions.IgnoreCase); public static int GetPageIDFromPath(string path) { return GetIDFromPath(lPageID, path); } example path that is sent to my function: /domain/Some-Landing-Page-Meta-Title-...

Handling Errors from HttpWebRequest.GetResponse

Hey experts - I'm having a ridiculous time trying to get an SMS API working (ZeepMobile, if you're interested) with .NET... I've been around .NET for a few years, but with all this social networking and API stuff, I need to get into the HttpWebRequest a bit. I'm new at it, but not completely new; I was able to hook up my site to Twitte...

MSBuild Conditional Imports

Is there a workaround for conditional imports in MSBuild? I've found evidence here and here detailing a bug in the MSBuild IDE interface. In particular, Import statements do not reload when building: This is a known limitation. VS will only ever process the tags once, when the project is loaded. So whatever tag is active at the...

How to kick off an asynchronus process?

I have a web form that once filled out needs to kick off a lengthy process. Since I don't want the user sitting there waiting for it to complete, I want to kick off the task and then take the user to another page to continue working. Would doing this involve using an asynchronus process, and if so, does someone have an example of how t...

Changing GridView column properties from code-behind.

I am creating a GridView in a method like so: GridView gridView = new GridView(); gridView.DataSource = reportData.Tables[0]; gridView.DataBind(); I am later exporting it to Excel and it works great. The columns are being auto-generated from my source data. I would like to change the DataFormatString property of some of the columns ...

object instance not set on page load?

I am trying to load my website and it says object instance not found. What do i do?? ...

Changing web.config file based on an Environment Variable in ASP.NET

I need to change my connection string in the web.config file based on an environment variable (for different enviornments, like dev/staging/production, etc). I have seen other solutions that use build tasks to accomplish changing different configurations, but haven't been able to find something that will let me change my connection stri...

MVC Re-populating posted data in a Html.TextBox from the Model (using Dictionaries)

Hello, I'm having problems repopulating a TextBox from data coming from a complex structure involving Dictionaries. So, I have VM structure like this: public class AnswerVM { public int Index { get; set; } public Answer Answer { get; set; } public Dictionary<int, QuestionResult> QuestionResults { get; set; } } public class Questio...

When to separate columns into new table

I have company, customer, supplier etc tables which all have address information related columns. I am trying to figure out if I should create a new table 'addresses' and separate all address columns to that. Having address columns on all tables is easy to use and query but I am not sure if it is the right way of doing it from a good d...

ASP.NET: httpwebrequest date header workaround

I'm trying to integrate with an API that requires the "Date" header in a web request. As you may well know, .NET has removed the ability to append or even display a default Date header in your request, so I was wondering about a workaround. Here's the catch: you can't use TCPClients because I don't have "permissions" on my server for su...

.Net, asp Global.asa equivalent

In classic asp you had the Global.asa file, what's the equivalent in .Net? I want a central point in which to create (once) a master DataSet that I want to be able to access throughout my application? What would be the correct event, onStart? Thanks R. ...

Bug in: System.Web.UI.Page.InitOutputCache() or in System.Web.Mvc???

Hi guys I'm using asp.net MVC with output caching (the OutputCache attribute) on some of my controller methods and am getting some really weird results in the HTTP headers. When I add the attribute to the controller action that handles the main page view. the following header is produced: Date Thu, 16 Jul 2009 23:0...

Integer zero, "0' will be ignored when upload to SQL Server.

i have a page that allow user to upload an excel file and insert the data in excel file to the SQL Server. Now i have a small issue that, there is a column in excel file with values, such as "001", "029", "236". When it's insert to the SQL Server, the zero in front will be ignored in SQL, so the data would become "1", "29", "239". The da...

RDS Replacement in Classic ASP and How to Do the same in .NET

We have an application that makes heavy use of the RDS.Dataspace. As in : set objDS = CreateObject("RDS.DataSpace") set objJB = objDS.CreateObject("JBdbio.dbio","http://&lt;%=Request.ServerVariables("SERVER_NAME")%&gt;") To instantiate and then: NewQry 2,"QryUpdtItem" ' To set the name of the stored procedure AddParam 255,"ISBN",20...

URL Rewriting in asp.net loses stylesheet mappings.

i noticed that when using the URL re-writter out of iis 7.0 that the root url character "~" works correctly but when I re-write the url with the global.asax file, the files no longer map correctly. Why is this and what can I do to have all the files map properly when using global.asax to re-write urls? If URL.Contains("/myurl/") Then C...

Link to Sql - Problems on Updating Database

Hello Everyone, I'm quite new to Linq and have had some problems updating my dabase. I don't know if it is actually happening for be using a global data context or I'm missing something. I have my typed DataContex and one Static Public Var to initialize it located within the namespace AlpaCommon, like following: My partial datacontext**...

How to load web user controls with interface type

I have a web user control which call some methods of an interface. Four different classes use this interface. public interface IMultiTextProvider { bool Insert(string text, Guid campaignId); IEnumerable<IMultiTextItem> GetItems(Guid campaignId); } In init or load I am setting up the controls like this (where wuc* is a control...

Calculating Total in gridview

I have a GridView with column Percentage. I want to get the total of Percentages in that colum. Can anybody help? ...