asp.net

ASP.NET Insert <% =i %> into ....

How can I append this <% =i %> variable onto this. <asp:DropDownList ID="AdTitle" runat="server"> Cant have this for some reason. <asp:DropDownList ID="AdTitle<% =i %>" runat="server"> ...

Switching all aspx files from local encoding to utf-8

Hello, how can I save all files in a directory using utf-8? There is a need to change the default file encoding in IIS to display all foreign characters correct. The problem is: all old files are saved in (different/random) encodings. Is there a way to open (in current) and save all those files safely to UTF-8? ...

Form tag on ASP.net page

I have a web application that has a page that loads the content from the database. I want to be able to put a form in the dynamic content, but .net doesn't let the inside form perform it's action. Is there a way to allow this or some other way I can get a form on a dynamic content page? Thanks. --EDIT-- I think I need to clarify som...

Update ValidationSummary list on control blurs?

A ValidationSummary will show a list of errors on postback. As each field is fixed, it's validator is fired, and any validation text will disappear. I want to automatically update the ValidationSummary as well. The following works fine: <asp:TextBox ID="ForenameTextBox" onblur="ValidationSummaryOnSubmit()" runat="server" /> but this ...

ASP/ASP.NET Best way to handle write permissions?

Say you have public ASP.NET (and Classic ASP) applications on IIS with a script/page that needs to write or update html files in a specific folder that is located within the web publishing folder tree. What is the proper way to handle this and exactly how do you do it? (i.e. set directory permissions in IIS or windows explorer) My main...

Unit Testing the Web GUI

Recently i heard a dicussion in which TDD was the hot buzz word. Now acc to one speaker that to test your behaviors you need to use MVC but on the other side its been said that TDD is an approach which can be adopted in any environment (as the discussion sorround between ASP.NET MVC or Webforms). The other guy claimed if you put your beh...

Correctly matching an ending tag with its starting tag in HTML with a RegEx

I'm using VB.Net in an ASP.Net 2.0 app to run some regular expressions that remove some unnecessary markup. One of the things that I'd like to do is remove span elements that don't have any attributes in them: output = Regex.Replace(output, "<span\s*>(?<Text>.*?)</span>" & styleRegex, "${Text}", RegexOptions.Compiled Or RegexOptions.Cul...

VB.NET Repeater Simple Data Binding Without Datasource

I've got a form that has to be a repeater on a webpage. I have a number parameter that tells me how many additional customer details are to be added. In this page I have a repeater control that needs to repeat items a set number of times. For each item there is a set of input boxes that needs an id appended to it. All I need to bind is a...

Activator.CreateInstance throws ArgumentNullException for parameter 'Type'

I recently encountered a problem with my Profile provider: it wouldn't retrieve profiles correctly (see error below). It worked locally, but when I put the code compiled by a Web Deployment project on a server it would crash. Value cannot be null. Parameter name: type Description: An unhandled exception occurred during th...

How do I bind an ASP.NET Repeater Control to an IList<String>?

I've never had to do this, but I'm binding a repeater to a generic list of Strings, and I'm not sure of the correct syntax. If I was binding to an IList and myType had a property LayerName I'd use this: <asp:Repeater ID="rptChecks" runat="server"> <ItemTemplate> <input type="checkbox" id="<%#Eval("LayerName") %>"/> ...

Custom multiselect gridview breaks on Row Update commands

I have an extended GridView class, GridViewEx, which inherits from the basic ASP.NET gridview. I override the CreateColumns method to intercept the columns collection and inject my own column, containing a modified CheckBoxField. (Sidenote: I tried looking some other method of storing and updating which rows were selected and just usin...

Question about Type Comparison ASP.NET and DBNull

I have a function that pulls articles records from an MSSQL database. Some are URLs to PDFs, and other are actual articles stored in the SQL. The articles that are stored do not have a URL (DBNull) in the record, so I want to be able to parse that. I tried a simple test: If Row.Item("url").GetType Is GetType(DBNull) Then //' do some...

Why does Visual Studio place a div tag in a new ASPX page?

By default, a new ASPX page contains the following: <body> <form id="form1" runat="server"> <div> </div> </form> </body> I'm curious--is there any reason I should leave that div tag in? ...

Which data framework is better for an ASP.NET MVC site - LINQ to SQL or NHibernate

We're about to embark on some ASP.NET MVC development and have been using our own entity framework for years. However we need to support more than our entity framework is capable of and so I'd like to get some opinions about using MVC with a more robust framework. We have narrowed down or choices to either NHibernate (with the Fluent API...

RegisterOnSubmitStatement after client-side validation

I need to insert a bit of Javascript into the process when a Web Form is submitted, but after the client side validation takes place. RegisterOnSubmitStatement seems to place the javascript before the validation. Anyone know how to get it to render after? Solution found: In a web control, I put something like this: protected overr...

Checking Page.IsPostBack in user controls

Is it recommended to check the Page.IsPostBack in a user control Page_Load Event like protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { } } I am getting wierd results Edit ~ Here is the thing. When the main form is loaded, I use Request.QueryString to get the custo...

Showing a form from a webpage

I have a problem I am trying to solve in an elegant manner. I have a .net application that I have created. I am trying to get one of the forms to be shown from a webpage. This sounds strange I'll admit, so here is the backstory We have some large monitors at work, that show information on them. I have no control over how the information...

How to call a C library from .NET

I have a C library which I need to call from an ASP.NET / C# app, how do I go about doing this? ...

asp.net unhandled exception

I have an application that has been running in produciton for a while now, and every now and then it throws an akward exception that I catch in the global.asax session error event. This procedure sends an email out with the error message, source, and stack of the error, and that is usually sufficient information for us to find the proble...

Is there a performance hit for using MDF SQL Server files instead of "database"?

Currently my website is written in ASP.NET Webforms using a SQL Server database. I am planning to build a ASP.NET MVC application not because it's better but because I want to learn the technology. My question is more specific to the database. I can create the database and import my SQL table via the import feature of the web interface t...