asp.net

How do I convert an ASP.NET page using Ajax webmethods to an Ajax-enabled servercontrol?

In this tutorial I am reading, Dave Ward creates a page that shows the server date in a label without using the update panel. I am trying to learn how to create servercontrols that use ajax for partial postbacks where methods within the control are called from clientscript generated by the same control, and I think that learning how to...

Updating web server from ASP.NET 1.1/2.0 to 3.5

I'm still fairly new to ASP.NET development so bear with me. I'm going to start development on an updated version of an ASP.NET 1.1 website, which I will develop in ASP.NET 3.5. Currently, my development server allows me to run web sites on 1.1 and 2.0. I've had the 3.5 framework installed, but is there any other configuring/issues I sh...

Annoying exception in asp.net

Hi, everybody; I have this problem in asp.net, I have a page where I insert and modify data, before saving I make a validation if it passes I save the data but if not I raise an exception and show it, the function goes like this; protected void btnSave_Click(object sender, EventArgs e) { try { ... if(ValidData()) //Save ... else t...

How do I store a dictionary object in my web.config file?

I'd like to store a simple key/value string dictionary in my web config file. Visual Studio makes it easy to store a string collection(see sample below) but I'm not sure how to do it with a dictionary collection. <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt...

Visual Studio 2008 sometimes won't open .aspx html markup

Every now and again I encounter a problem where Visual Studio Professional 2008 (SP1) refuses to open an aspx page. My site is in a Web Application Project. Double clicking on the aspx page in solution explorer just causes the tree view node with the code behind and .designer.cs to collapse and expand, it's almost as if VS thinks the ...

X509 Public Cert and Permissions

I’ve got an issue with loading a particular X509 certificate within an ASP.NET application (i.e. not through IIS for https). I’ve loaded it into my ‘Personal’ and ‘Trusted Root’ stores on my local machine (through the MMC snap in) but can’t load it from either store. It seems the NETWORK SERVICE account doesn’t have permissions to read/...

selectedIndex is lost during postbacks - ASP.NET

I have a list box control: <asp:ListBox runat="server" id="lbox" autoPostBack="true" /> The code behind resembles: private void Page_Load(object sender, System.EventArgs e) { lbox.SelectedIndexChanged+=new EventHandler(lbox_SelectedIndexChanged); if(!Page.IsPostBack) { LoadData(); } } private LoadData()...

Can You Determine Timezone from Request Variables?

Is there a way to do your timezone offsets on the server side, by reading something in the request over http, instead of sending everything to the client and letting it deal with it? ...

How to consolidate config files in asp.net solution?

I have several projects and a website in a large asp.net solution. In some of projects I have an app.config file and in the website I have my web.config. In each config I specify several things that are common amongst them, such as connection strings. Is there any way to consolidate these common items into one config file and referenc...

Displaying available strongly typed resource classes in Property Window

I'm extending the Gridview Web Control as my first attempt at creating a custom control. As part of the extension I am encapsulating the localization of the grid column headers within the control. Among others, I'm exposing a couple of properties to enable this feature: bool AutoLocalizeColumnHeaders - enables the feature string Heade...

Converting an asp:ButtonField to an asp:TemplateField in a GridView Control

I currently have a gridview that has an asp:ButtonField as one of the columns. The event handler for the command extracts the row id of the gridview from the command argument and uses that to perform some logic. I now need to switch to using a template field for this column, and want to do something like this: <asp:TemplateField HeaderT...

Will ASP.Net remove individual tables from a cached dataset to free up memory?

I have a strange, sporadic issue. I have stored procedure that returns back 5 small tables (e.g. IDs and Text Descriptions for Status drop down lists and such). The code calls this and places the returning dataset into ASP.Net cache. Separate methods are called to retrieve individual tables from the dataset to databind to controls t...

How to call a client side javascript function after a specific UpdatePanel has been loaded

How is is possible to call client side javascript method after a specific update panel has been loaded? Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler) does not work for me because this will fire after ANY update panel finishes loading, and I can find no client side way to find which is the one ScriptMan...

Shared localization for asp.net, javascript and silverlight?

How do you localize ASP.NET + javascript + Silverlight? I would like to be able to include the same texts in different languages in asp.net pages, javascript on the page, and Silverlight objects on the page. I have tried with the following method, but have no experience with it in practice, and I would like to hear your opinions on it ...

ASP.NET: Setting the Style of an HTML element Programatically

Hi! I'm generating a menu with a Repeater control bound to an XmlDataSource. <asp:Repeater ID="myRepeater" runat="server" DataSourceID="myDataSource" onitemdatabound="myRepeater_ItemDataBound" onitemcreated="myRepeater_ItemCreated"> <HeaderTemplate> <ul class="menu_list"> </HeaderTemplate> <ItemTemp...

Wrapping GridView text without a visible space

I have a GridView with several fields, one of which can potentially have a crazy wide value in it like this: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa If that sort of thing is in the field, I want it to wrap. I can easily insert a character in code every 50 characters or so...but what ...

ASP.NET MVP - Utilizing User Controls

I'm writing my first app with ASP.NET MVP (attempting Supervisory Controller) and Unit Testing (better late than never!), and I've run into a bit of a dilemma. I've written 3 User Controls, all tested and Interfaced up, Presenters in tow. Now I have come to a Page which takes these three User Controls and encountered the following prob...

Extract RSS/ATOM URLs from HTML LINK tags

What is the best way to extract RSS/ATOM URLs from HTML LINK tags? I know regex is not the best way to do this, so I'm wondering what alternatives I have. Surely some kind of horrible string munging using .Contains after loading the HTML into a string is not optimal either. Anyone got a decent strategy for this? ...

Allowing dangerous query strings

I need to be able to allow query strings that contain characters like '<' and '>'. However, putting something like id=mi<ke into the the URL will output an error page saying: A potentially dangerous Request.QueryString value was detected from the client (id="mi<ke"). If I first url encode the url (to create id=mi%3Cke) I still get the ...

ASP.NET session - How can I tell if a session is new due to expiration or initial visit?

We have a page of search results which the user can hit in several ways. 90% of the ways will set up a 'Search Criteria' session object, which the results page will use to retrieve the search results. When the session object isn't found, we will typically show the user an 'invalid search' message, and give them a link to the main searc...