asp.net

Should I use Trim function everytime when I insert data from webpage to database ?

Hello just wondering Should I use textbox.text.Trim() function every time when I insert any data from web page to database. I just have a habit of using the trim function? Does it effect the performance any way? Should I use everytime or just when needed? ...

Is it possbile to bind a PagedDataSource to a generic list?

I have a method to return a group of objects as a generic list which I then bind to a Repeater. I want to implement paging on the repeater using the PagedDataSource class but I'm not sure that this is possible as it doesn't seem to work. Will I have to change the return type of my method or is it possible to bind the PagedDataSource to ...

Using extension methods within inline databinding context

I'm trying to use some extension methods that I use to apply consistent formatting to DateTime and Int32 - which works absolutely fine in code behind, but I'm having issues with databinding. I get: 'System.DateTime' does not contain a definition for 'ToCustomShortDate' for <%# ((ProductionDetails)Container.DataItem).StartDate.ToCust...

ASP.NET inject javascript in user control nested in update panel

Hi folks, I'm trying to load javascript code with a user web control into a page via a the Page.LoadControl method during an asyncron post back of an update panel. I've tried the specially for that scenario designed methods of the scriptmanager, but the javascript just doens't get returned to the user. To explain my scenario a bit bet...

Rebinding events in jQuery after Ajax update (updatepanel)

I have several input and option elements on my page, each (well almost) have an event attached to update some text on the page once they change. I use jQuery which is really really cool :) I also use Microsofts Ajax framework, utilizing the UpdatePanel. The reason why I do that is that certain elements are created on the page based on ...

Error with ASPNET RoleProvider

I just installed an application on a win2003 server and I'm getting this error: Line 149: <roleManager> Line 150: <providers> Line 151: <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, Public...

Break points aspx pages

How do you set a break points in server tags in .aspx pages. e.g. <% dim breakhere =new object() %> The web application is running in debug mode with the <compilation debug="true" ... in the web.config. But the page says: The break point will not currently be hit. No symbols have been loaded for this document. Is there any...

How do you preserve HTML in a jQuery AJAX request?

I am working on a project that I want to implement AJAX, and I have decided on jQuery as a JavaScript Library. Here is the HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head runat="server"> <title>jQu...

Singleton vs Cache ASP.NET

I have created a Registry class in .NET which is a singleton. Apparently this singleton behaves as if it were kept in the Cache (the singleton object is available to each session). Is this a good practice of should I add this Singleton to the Cache? + do I need to wacth out for concurrency problems with the GetInstance() function? names...

How do I force SqlDataSource to use varchar parameters?

I'm using a SqlDataSource to populate my GridView, because the two seem to be so tightly coupled together. Since this grid shows results of a search, I have a dynamic sql string being written in my codebehind that references parameters I pass in, such as below: sdsResults.SelectParameters.Add("CodeID", TypeCode.String, strCodeID) My p...

[ASP.NET] Expandable Rows on a Gridview

Does anyone have any insight on how to have each row in a Gridview expand to show a DIV or PANEL that has a form of elements, i.e. a simple form of textboxes, etc. I don't need a nested Gridview showing results or using DynamicPopulate. I have tried some techniques from a DataGrid Expandable Row, but ran into some problems trying to acc...

What causes an application pool in IIS to recycle?

I have been searching for info on this to no avail. The context of why i need this is another question I asked here. More specifically, does creating/updating/deleting files in App_Data cause a pool recycle? If someone could provide a detailed list of what causes a recycle, that would be great. UPDATE: As two users already noticed I wo...

Is it acceptable to keep a db connection open for the life of the page?

Everybody knows that you should close a connection immediately after you finish using it. Due to a flaw in my domain object model design, I've had to leave the connection open for the full page life cycle. Essentially, I have a Just In Time property which opens a connection on first call, and then on Page.Unload (..) it would check if ...

ASP.NET Globalization -- Displaying dates

Good morning, Apologies for the newbie question. I'm just getting started with ASP.NET internationalization settings. Background info: I have a website which displays a <table> HTML object. In that <table> HTML object, I have a column which displays dates. My server being in the US, those dates show up as MM/DD/YYYY. Many of my us...

Separate Applications Sharing the Same ASP.Net Session Cookie

I've got two ASP.Net applications residing in two different folders on my server: /Foo <-- this is the standard unsecure application /Secure <-- this is a separate application that requires SSL by IIS The problem is that by default, the ASP.NET_SessionId cookie is specified on the domain and is shared between the two applications in ...

Custom TextBox with built-in Validator: server side validation not firing

I have a class that looks like this: public class TextField : TextBox { public bool Required { get; set; } RequiredFieldValidator _validator; protected override void CreateChildControls() { base.CreateChildControls(); _validator = new RequiredFieldValidator(); _validator.ControlToValidate = this.ID; ...

ASP.net information event "Application compilation is starting"

Hi all: We use MSMQ to capture all the event thrown by our asp.net site and store the data into our database. Throughout the day, we can see the event id "1003" with Title = "Application compilation is starting" in our logging database. However, we don't see the corresponding event 1004 which is "Application compilation ends". I was ...

Display string with whitespace in ASP.NET?

I need to display a string which has a white space on a asp.net page. **Here is what I am doing:** cell = New TableCell cell.Text = value (lets assume value is <" test with whitespace "> row.Cells.Add(cell) and it gets rendered as " test with whitespace " whitespaces within single quotes are not displayed. I want thi...

Debugging any entry point.

I'm working with a BasePageClass that derives from System.Web.UI.Page. What I'd like to do is somehow set a break point for every single time a method or property on this page is accessed. The only way I know how to do this is set up a breakpoint on every property and method on the page. This just doesn't seem practical. Does anybody...

Call a webpage from c# in code

I need a way of calling a web page from inside my .net appliction. But i just want to send a request to the page and not worry about the response. As there are times when the response can take a while so i dont want it to hang the appliction. I have been trying in side the page_load event WebClient webC = new WebClient(); Uri newU...