asp.net

ASP.NET State Management in appropriate situations.

There are 6 techniques to manage states in ASP.NET 3.5 (as far as I know). (1) View State (2) Cross Page Posting (3) Query String (4) Session State (5) Application State (6) Cookies Can anyone give me some appropriate examples of situations where I should use these techniques? For example: (*) Session State: Personalization, Buy Car...

ASP.NET MVC - Pass Additional ViewData to a Strongly-Typed Partial View

I have a strongly-typed Partial View that takes a ProductImage and when it is rendered I would also like to provide it with some additional ViewData which I create dynamically in the containing page. How can I pass both my strongly typed object and my custom ViewData to the partial view with the RenderPartial call? var index = 0; foreac...

Can you validate an inactive user's password in ASP.NET's membership system?

I am creating an activation form for newly-created users in ASP.NET's membership system. When the user is created I send an email with a link to an activation page. However, before the user is activated, I want to verify their user name and password, so I have them enter their credentials into text boxes. However, based on what I've r...

How to initialize a ASP.NET User Control With parameter?

For example, I have a user control(ascx) with a label inside, I will use the the user control in my aspx page. How can I pass a string value to the ascx page so that it can be display in the label of ascx page at the beginning? ...

Convert number in excel into string?

i'm trying to import an excel file into SQL Server but if any of the column containing number value like "12355484645" and when it's inserted into SQL Server, the value will become "1.05e+010". Beside the methods of adding "'" in front the value or formatting the excel column, how do i convert the format in asp.net code-behind? ...

Asp.net MVC same view name, different paths

I want to have multiple path folder structure that contain same name views: /profile.aspx /admin/profile.aspx /user/editpost.aspx /admin/editpost.aspx /Controllers |- PostController.cs |- ProfileController.cs I want to be able to have all the regular pages in a folder and the admin pages in another folder. Do I need to organize m...

Web user control usage

Is there a simple way to determine where web user controls (wuc) are used in a solution? I'm trying to get an overview of what's going on in a rather big applications, where I have a large number of wuc's, used both in aspx and nested in other wuc's. Any suggestions are welcome. :) ...

Custom Validation

I am having two textboxes and a submit button. I have applied Custom validation to the First TextBox. When i am loosing my focus from the first textbox, Custom validator is doing validation.But i want that validation on Button Click only. ...

Accessing data from my SqlDataSource in the code behind C# .net

I have a contact page where there is a datalist of people and if you click on one of them you get a contact form that I want to send to that particular person. I use sqldatasource dscontactemail to get information about that person to place on the contact form but how do I get information out of dscontactemail from the code behind for w...

How to implement back functionality in a asp.net web page?

Hi All, I have a page which has a panel whcih contains various buttons to load different pages. I have two butons in that panel one is "Search Products" and one is "Add Product". When i click Add Product it loads the corresponding page , on this page I have a button which takes me back to Serach Products page , now I want to know someho...

Is it usual for ASPX files to take 5-10 seconds to save?

Using Visual Studio 2008 with Resharper, is it usual for ASPX files to take a long time to save? I usually find that it takes up to about 10 seconds on an average PC (18 months old). What is it doing? ...

Parse aspx page for Checkbox inputs via the C# Codebehind

I am trying to parse the html side of an aspx page from the C# code behind. Essentially I have a with multiple checkboxes that are named as such: qlcbXX with XX being an id of an item pulled from a database. What i would like to do is a) parse linkSelections for all the checkbox inputs b) determine if they are checked c) if checke...

How to get div content which changed by javascript?

I have a div on page, which content will change by javascript, I want get its value from c# code. but, its always returns empty or initial value, not changed value. If I changed from div to hidden, it works well. I don't know why? here is the code: <head runat="server"> <title>Untitled Page</title> <script type="text/javascri...

COMException when trying to use a Library

Hi Guys, I have an ASP.net WebService which uses a Library, this has a dependency on some third party .dlls. If I add a reference to the Library to my webservice, I get a COMException and I can't load the site. I thought it may be to do with aspnet user credentials, so I have tried impersonating and using processModel in machine.config...

ASP.net Listview EditTemplate Hide/Show Options by Checkbox

Hey guys, I'll get right to the point. I have a listview which has an ItemTemplate and EditTemplate. When I switch an item into edit mode I have a bunch of checkboxes as options. Now the problem. in Editmode I would like to have certain options disappear (or replaced by "--") when certain checkboxes are unchecked and of course reappea...

Is ViewState relevant in ASP.NET MVC?

I am learning ASP.NET MVC and many concepts of "ASP.NET" like authentication, authorization, session state still apply to it. But from whatever little I have understood, I don't see that ViewState is still relevant in an ASP.NET application. But it is there (property of System.Web.Mvc.ViewPage)! Is it there only for compatibility reason...

How can I add a registered trademark symbol (R) to an asp:RadioButton control declaritively?

I want to show a registered trademark symbol (i.e. an 'R' in a circle) in a label on a web page. But I want to add it in the design view markup not in the code-behind file. Is there an equivalent of &copy? EDIT: Any idea how I use this when defining a radio button as it doesn't work when applied to the Text property of an asp:RadioButt...

XSLT. load xml document that contains escape characters

I use XSLT to transform an XML document which I then load on to a ASP.NET website. However, if the XML contains '<' characters, the XML becomes malformed. <title><b> < left arrows <b></title> If I use disable-output-escaping="yes", the XML cannot be loaded and I get the error "Name cannot begin with the '' character". If I do not di...

SQL Express connection string hell ASP.Net

SQL Express 2005 is running locally. I have a project written by another person running on the same machine. All I want to do is connect to it, can't be that hard right? This is the one I use in my old classic ASP code to hit another database running on the same instance: Provider=SQLOLEDB;Data Source=MYLAPTOP\MSSMLBIZ;Persist Security...

How to create a SQL Compact 3.5 database for Windows Mobile in an ASP.NET web application?

In an ASP.NET web application I have to dynamically create a SQL Compact 3.5 database for a Windows Mobile Compact Framework application from a data source (SQL Server). I have to create the database file, needed objects (tables, ...) and fill the tables with data. The client application (Windows Mobile device ) will download that gene...