Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com ASP.NET ASP.NET
ScrollToControl helper method for ASP.Net web forms to move position to particular control
I've created a helper method for ASP.Net web forms to move position to particular control /// <summary> /// /// </summary> /// <param name="page"></param> /// <param name="clientId"></par... /// <param name="alignToTop"></p... public static void ScrollToControl( Page page, string clientId, bool alignToTop) { //NOTE: if there are more than one call on the page, first one will take preference //If we want that last will take preference, change key from ......

Posted On Wednesday, February 17, 2016 9:36 PM

Tiny MCE editor in ASP.Net Web Form
I wanted to implement rich text editor in ASP.Net Web Form. I found that Tiny MCE editor is very popular and selected it.I've followed the article http://blog.tentaclesoftwar... and it was enough to make it workingAnother article, that I read was http://www.aspsnippets.com/... ......

Posted On Sunday, January 24, 2016 2:21 PM

Response for REST method was truncated because default MaxItemsInObjectGraph was not big enough.
We have a REST service with attributes [WebGet(UriTemplate ="...", BodyStyle =WebMessageBodyStyle.Bare, ResponseFormat =WebMessageFormat.Xml)]Norm... it worked fine. But for particular data it has a huge response that was truncated. The size returned in a few attempts in IE browser was 2196456, in Chrome slightly different 2195397.After a search in google I found http://forums.asp.net/post/... that has a number of suggestions. For WCF service that will transfer large amount of data in ......

Posted On Sunday, June 2, 2013 2:29 PM

Missing error handling in Streaming-AJAX-Proxy Log
We are using AjaxProxy(FROM http://www.codeproject.com/... on our web site, but started to notice errors accessing log.txt file. I found that the file is created by Log class and doesn't have ability to switch it off and error handling. I've added reading file name from configuration and try/catch block public static class Log { private static StreamWriter logStream; private static object lockObject = new object (); public static void WriteLine(string msg) { string logFileName ......

Posted On Saturday, October 6, 2012 12:49 PM

Adding Async=true to the page- no side effects noticed.
Recently I needed to implement PageAsyncTask in .Net 4 web forms application.According to http://msdn.microsoft.com/e... PageAsyncTask object must be registered to the page through the RegisterAsyncTask method. The page itself does not have to be processed asynchronously to execute asynchronous tasks. You can set the Async attribute to either true (as shown in the following code example) or false on the page directive and the asynchronous tasks will still ......

Posted On Sunday, September 30, 2012 11:55 AM

Configuration setting of HttpWebRequest.Timeout value
I wanted to set in configuration on client HttpWebRequest.Timeout.I was surprised, that MS doesn’t provide it as a part of .Net configuration.(Answer in http://forums.silverlight.n... thread: “Unfortunately specifying the timeout is not supported in current version. We may support it in the future release.”) I added it to appSettings section of app.config and read it in the method of My HttpWebRequestHelper class //The Method property can be set to any of the HTTP 1.1 protocol verbs: ......

Posted On Friday, June 15, 2012 9:56 PM

Log JavaScript errors to the server.
Some time ago I found debugging - Automatic feedback on JavaScript error - Stack Overflow. and the discussion has links to Logging JavaScript Errors To ASP.NET(Unfortunately the link to download in the post is broken).and custom control to help log JavaScript errors by sending error information to the server -thecodepage.com/post/JavaS... downloaded solution from JSErrorNotifier.zip. When I wanted to include dll into my solution dependencies, I decided to rename WebControls.DLL ......

Posted On Wednesday, April 25, 2012 11:55 AM

Select tool to minimize JavaScript and CSS size
There are multiple ways and techniques how to combine and minify JS and CSS files.The good number of links can be found in http://stackoverflow.com/qu... and in http://www.hanselman.com/bl... There are 2 major approaches- do it during build or at run-time.In our application there are multiple user-controls, each of them required different JS or CSS files, and ......

Posted On Sunday, April 15, 2012 8:08 PM

Dump an arbitrary object To Html String
For debugging purposes me and my collegue wanted to dump details of the arbitrary object, and created function that uses LINQPad Dump functionality (thanks to http://stackoverflow.com/a/... and original http://linqpad.uservoice.co... discussion) public static string DumpToHtmlString<T>(this T objectToSerialize) { string strHTML = ""; try { var writer = LINQPad.Util.CreateXhtmlWri... ......

Posted On Saturday, April 14, 2012 2:50 PM

Translate jQuery UI Datepicker format to .Net Date format
I needed to use the same date format in client jQuery UI Datepicker and server ASP.NET code. The actual format can be different for different localization cultures.I decided to translate Datepicker format to .Net Date format similar as it was asked to do opposite operation in http://stackoverflow.com/qu... Note that replace command need to replace whole words and order of calls is importantFunction that does ......

Posted On Saturday, April 14, 2012 10:40 AM

CodePlex downloads without strong name for an assembly
I wanted to use http://cache.codeplex.com/ in my solution, but it caused compile errorAssembly generation failed -- Referenced assembly does not have a strong nameREASON: When you compile an assembly with a strong name, any referenced assemblies must also have strong name.I could sign Cache project using Visual Studio or using commands as described in “Tip related to strong name”. But It also required to sign referenced DLLs, like BplusTree from http://bplusdotnet.sourcefo... I’ve ......

Posted On Saturday, March 10, 2012 11:31 PM

Custom HTTP response header to identify server in a farm.
We wanted to follow recommendation from http://omaralzabir.com/best... to“add “From” header and set the server name. I do this on each webserver and specify different names on each box. It’s handy to see from which servers requests are being served. When you are trying to troubleshoot load balancing issues, it comes handy to see if a particular server is sending requests” However one of the client of our rest service reported that From value in the response ......

Posted On Saturday, March 10, 2012 10:51 PM

Change DocType dynamically
I have a single page(created before Master pages were available) that loaded dynamically one or another user control.Some child controls have css for quirk mode, but for new controls I want to use latest DocType <!DOCTYPE html> The solution is to set it dynamically in code-behind depending on current control to load(the code is copied from http://stackoverflow.com/qu... =========aspx=============== <%@ Page Language="C#" ......

Posted On Friday, September 23, 2011 9:38 PM

Changing “Trusted Sites” list affected HttpWebRequest in application running under different account
We have a webscraper ASP.Net application, that worked fine on developers and test environments, but didn’t work on some machines with more strict security settings. HttpWebRequest failed with System.Net.WebException: Unable to connect to the remote server It start working when my colleague added the site that application tried to access to his “Trusted Sites” zone using Internet Explorer. What we couldn’t understand, how it affected an application that ran under DIFFERENT account. I didn’t find any ......

Posted On Saturday, September 10, 2011 7:45 AM

Localization Approach for ASP.NET Web site
String Resources For string resources we will use local/global resources connecting to DB using DbResourceProvider from “Creating a Data Driven ASP.NET Localization Resource Provider and Editor” http://www.west-wind.com/pr... It also has DbResourceControl, that shows controls with Localizable attribute and connect them to editor. From http://guysmithferrier.com/... and http://www.guysmithferrier.... ......

Posted On Saturday, July 2, 2011 9:00 PM

Combining javascript files
I’ve read Combining Client Scripts into a Composite Script and wanted to use it. Then I’ve read Julian Jelfs concerns ScriptManager.CompositeScript issues However the article Combining javascript files with Ajax toolkit library describes workarounds, that make the solution workable. You also can use Script reference profiler: http://aspnet.codeplex.com/... Related posts: Using ScriptManager with other frameworks MSDN documentation: CompositeScriptReference The older implementations, ......

Posted On Sunday, June 26, 2011 6:27 AM

Message : A potentially dangerous Request.Path value was detected from the client (:).
We’ve noticed in event log the following error: Message : A potentially dangerous Request.Path value was detected from the client (:). Type : System.Web.HttpException, System.Web, Version=4.0.0.0, Culture=neutral, Message : A potentially dangerous Request.Path value was detected from the client (:). Source : System.Web WebEventCode : 0 ErrorCode : -2147467259 Stack Trace : at System.Web.HttpRequest.Vali... at System.Web.HttpApplication.... ......

Posted On Thursday, June 9, 2011 7:42 AM

Validation of Html file
We’ve used HtmlAgilityPack based function IsValidHtmlFragment(string html) to validate dynamically loaded Html Fragments before inserting into main page(or do not insert if it is invalid) and recently noticed that it doesn’t return false for some fragments with not closed tags. I decided to find some other tool to call from the code and found that most of HTML parcers are too forgivven(like browsers) or too strict- to check full XHTML conformance. I am going to add manual procedure to run Tidy.EXE ......

Posted On Wednesday, June 1, 2011 6:36 AM

RemoveQueryStringFromUrl helper function
I've recently added to my UriHelper class the function RemoveQueryStringFromUrl public static string RemoveQueryStringFromUrl(st... url) { //similar to string qs = QueryStringHelper.QueryStri... string urlPath = url.LeftBefore("?"); return urlPath; } It refers to methods from My QueryStringHelper class and My StringHelper class ......

Posted On Thursday, May 12, 2011 6:59 AM

JavaScript function to Redirect parent of IFrame to specified URL
/// <summary> /// Redirects parent of IFrame to specified URL /// If current page doesn't have parent, redirect itself /// </summary> /// <param name="page"></param> /// <param name="url"></param> public static void NavigateParentToUrl(Page page, string url) { String script = @" try { var sUrl='" + url + @"'; if (self.parent.frames.length != 0) self.parent.location=sUrl; else self.location = sUrl; } catch (Exception) {} "; page.ClientScript.RegisterS... ......

Posted On Friday, March 19, 2010 6:34 AM

Comment in JavaScript code doesn't comment the server command
Comment in JS code doesn't comment the server command. It is correct, but can be visually confusing. I had the following line in markup ASCX file. // var trs = document.getElementById('&l... %>').getElementsByTagNam... Visual Studio showed it as green comment. However when server control pnlOutsideSearch was renamed, the errors were generated, and it took me some time to realize, what wrong with the line, tha it was look like just comment ......

Posted On Friday, November 27, 2009 7:07 PM

Remix10 AU- lessons learned.
I've attended Australian Remix10 and below is a list the points, that I've learned and/or want to read more about. The materials of US MIX10 conference are here http://live.visitmix.com/ Windows Azure ( pronounced [azh-er] http://dictionary.reference... - sounds great from hosting costs/redundancy, but how much work is required to change existing asp.net application with SQL backend to support Azure. http://www.azuresupport.com... ......

Posted On Monday, July 5, 2010 6:22 AM

Upgrade to ASP.Net 4 on Web Farm
Recently we upgraded Web Farm web site to ASP.Net 4. We studied .NET Framework 4 Migration Issues and, fortunately, didn't found any serious issues, related to our site. Before all sites will be converted to .Net 4, for forms authentication cookies to work across .NET Framework versions, we've added <system.web> <machineKey validation="SHA1" /> </system.web> Tests were successfull on single computer, but when we started to test new version on Web Farm, we started to see intermittent ......

Posted On Saturday, June 26, 2010 9:59 PM

Helper methods StartOfMonth and StartOfNextMonth
There are couple methods recently added to My DateTimeHelper class public static DateTime StartOfMonth(this DateTime dateValue) { return new DateTime(dateValue.Year,dat... } public static DateTime StartOfNextMonth(this DateTime dateValue) { return StartOfMonth(dateValue).Add... } ......

Posted On Friday, June 11, 2010 6:26 PM

My version of UnhandledExceptionModule
I've created my own version of UnhandledExceptionModule independantly of codePlex project in 2007, I've used code from http://support.microsoft.co... with considerations from http://www.eggheadcafe.com/... and done some refactoring. It also allows to use AppSettings["EventLogSource... The zip file also includes TestUnhandledExceptionWAP test project, that I used to investigate issue legacyUnhandledExceptionPolicy enabled="true" doesn't prevent ASP.NET application restarting ......

Posted On Friday, June 11, 2010 6:22 PM

ASP.NET Validators should be visible to do validation
Validators are disabled, if they are not visible. They can be not visible, if any of their containers is not visible. In general, they should be always visible, but the message will be shown only if they will be NOT valid. Also consider to set BaseValidator.SetFocusOnErr... In big pages use ValidationGroup combined with CausesValidation property set to true ......

Posted On Sunday, August 23, 2009 6:41 AM

DDD Melbourne -lessons learned
I've attended DDD Melbourne and want to list the interesting points, that I've learned and want to follow. To read more: * Moles-Mocking Isolation framework for .NET. Documentation is here. (See also Mocking frameworks comparison created October 4, 2009 ) * WebFormsMVP * PluralSight http://www.pluralsight-trai... * ELMAH: Error Logging Modules and Handlers Great for new sites or sites without error logging/monitoring. However if you site already have working error ......

Posted On Tuesday, May 18, 2010 7:47 AM

ASP.NET Conversion to WAP bug - autoeventwireup Changed to True
When ASP.NET page converted to WAP, it changed autoeventwireup to True- see autoeventwireup Changed to True in C# Conversion to WAP discussion. Autoeventwireup is easier for coding, but there are disadvantages(according to MSDN): One disadvantage of the AutoEventWireup attribute is that it requires that the page event handlers have specific, predictable names. This limits your flexibility in how you name event handlers. Another disadvantage is that performance is adversely affected, because ASP.NET ......

Posted On Wednesday, March 25, 2009 1:47 AM

Upgrade VS Web Site Project to be VS Web Application Project (WAP)
One of my colleagues wanted to upgrade VS 2005 Web Site Project to be VS 2005 Web Application Project. I pointed him to http://webproject.scottgu.c... Then we had an issue with non-compiling files from OLD_APP_CODE folder-they had Build Action as Content (see http://forums.asp.net/p/106... And now I've read Rick Strahl's post. VS 2008 doesn't have conversion wizard at all. The process has become fully manual-but well described in Rick's post ......

Posted On Thursday, November 13, 2008 5:15 AM

Manipulation with cells, generated by GridView DataControlField derived classes.
I've previously posted "Access to BoundField value when GridView row is selected." Sometimes you need to customise DataControlField derived field (e.g. HyperLinkField or ButtonField )to show it differently then default behavior, but you don't want to create template for the field. If you customization requirements are compex, use TemplateField. Below there is an example, how you can access cell, generated by HyperLinkField and change content of the cell. E.g for HyperLinkField column you normally ......

Posted On Friday, October 31, 2008 12:10 AM

DropDownList.SelectedValue returns UpperCase string.
I've noticed that DropDownList.SelectedValue returns Upper Case string, even if Items in ListItemCollection are shown in mixed case in debugger and in html. I tried to confirm it using Reflector , but didn't find particular code to call ToUpper. Is it only my application or .Net framework(I am using 2.0) ? Anyway, it is a good practice to call ToUpper() if you want to compare DropDownList.SelectedValue with other strings ......

Posted On Monday, December 10, 2007 4:39 PM

Insert CSS link with updatable version number in URL
More than a year ago I wrote a post Code Render Blocks does not work inside HEAD server controls about the problem, that prevented me to update URL of CSS file, when version of assembly incremented. Now I've created a function /// <summary> /// /// </summary> /// <param name="page"></param> /// <param name="cssFileHref">e.g. "~/StyleSheet.css"</para... /// <returns></returns... public static HtmlLink AddStyleSheetLink(this Page page, string cssFileHref) ......

Posted On Thursday, February 12, 2009 9:13 PM

Display content of page in a modal dialog- consider jqModal.
I need to show popup info message with single close button, but content is located in separate html file. The current implementation using window.open not working for many users with popup blockers. My question is which tool/framework should I use. Initially I considered to use UFrame (see CodeProject article:UFrame: goodness of UpdatePanel and IFRAME combined )inside ASP.NET AJAX ModalPopup. Then I found question http://stackoverflow.com/qu... ......

Posted On Monday, January 26, 2009 11:53 AM

How to disable IIS application pool
I wanted to disable a few web application on IIS server, running within the same application pool. I've opened the pool properties, but I didn't find the option to disable. I've tried to find in Google, but didn't find the answer. So I decided that changing identity to some not authorized user will be sufficient. Fortunately, my collegue told me, that to disable pool you need to STOP it. And pool will be stopped until you as Admin explicitely start it.- it is not re-started autiomatically after reboot. ......

Posted On Wednesday, December 5, 2007 10:16 PM

Specify Expect100Continue=false in Web Service client.
The Web Service Provider that we are using recommends NOT send Expect100Continue header. The specifying static value System.Net.ServicePointMana... is not good, because some other providers may prefer to use the header. In the haacked's "HttpWebRequest and the Expect: 100-continue Header Problem" post comment of Mirronelli Jun 02, 2005 6:22 AM suggest to specify webRequest.ServicePoint.Exp... = false; for each webRequest. If I am using web service(derived from ......

Posted On Tuesday, January 13, 2009 11:47 PM

IIS Set Expiration Dates adds the expiration header only to static content
12 Steps To Faster Web Pages With Visual Round Trip Analyzer recommends (among others useful suggestions) to Set Expiration Dates - follow Using Content Expiration (IIS 6.0), . I've looked in a few articles, including Best Practices for Speeding Up Your Web Site, "Optimizing a Page-Load Performance Profile and Optimization of a Web Site - Using Content Expiration (IIS 6.0) . Finally the post IIS Content expiration header and ASP.NET cleared my concerns: IIS is smart enough to add the expiration header ......

Posted On Wednesday, December 31, 2008 3:57 PM

Links:How to save html file to PDF
I want to save html file generated by ASP.NET to PDF. I was pointed to itextsharp open source project. I found a few links, discussing how to do it: http://www.velocityreviews.... iTextSharp Tutorial Chapter 7: XML and (X)HTML iTextSharp Demo(asp.net 2.0):http://rubypdf.com/ite... introduces HtmlParser.Parse.(see the source code here) We tried to use it. HtmlParser.Parse does NOT throw any error , ......

Posted On Friday, July 18, 2008 9:55 PM

Profiling Performance of ASP.NET Code Links
Below are a few links that I found about Profiling Performance of ASP.NET Code Code performance analysis in Visual Studio 2008 and Find Application Bottlenecks with Visual Studio Profiler * Tool : VSProfiler - Analyze Performance of Managed Code How To: Use CLR Profiler and Transcript: Profiling Managed Code with the CLR Profiler are talking about CLR memory allocation profiler. - * Auto Performance Tuning in ASP.NET 2.0 process model (processModel) section of machine.config comes with default value ......

Posted On Thursday, July 3, 2008 1:20 AM

Override ASP.NET Menu javascript functions to delay dynamic menus popup.
We are using asp.net Menu control and wanted to have some delay before sub-menu popup to avoid annoying popup, if user just move mouse through menu area. After some search on Google I found the solution submitted by yupinggang on the thread delaying the menu control. I've slightly modified it( put in a separate JS file,call initMenuMouseHoverInterceptors just in the same file,added handling of the case if no menu on the page etc.) Another possible solution- override PreRender in derived from Menu ......

Posted On Wednesday, June 4, 2008 11:04 AM

Helper function to Print Page using JScript(including inside frame)
///<summary> /// Helper function to Print Page using JScript(including inside frame) ///</summary> ///<param name="page"></param> public static void PrintPage(Page page) { //In case if page is in frameset, you need to call parent.window.print() String script = @" if (parent!= self) { parent.window.print(); } else { window.print(); } "; RegisterOnceStartupScript(p... MethodBase.GetCurrentMethod... } public static bool RegisterOnceStartupScript(Page ......

Posted On Sunday, June 1, 2008 2:48 PM

RadioButton with Image instead of text
I want to have RadioButton with Image instead of text, that clicking on image the check-box will be selected In the thread it is shown Radio button (without any text) and image on it's side.(but not inside radio-button) <asp:RadioButton ID="RadioButton2" runat="server" GroupName="A1" /><asp:image runat="server" id="Image2" /><br /> Radiobuttonlist Image Setting thread suggests to use code RadioButtonList1.Items.Add(New ListItem("<img src=""" + s + """/>", s)) It will be useful ......

Posted On Friday, May 16, 2008 4:21 PM

New posts of source code about old Asp.net custom controls
I've found in my source code library a few custom ASP.NET controls that could be useful for someone. ASP.NET custom control TextFileViewerControl ASP.NET composite control FromToTextBoxes ASP.NET custom control CheckBoxWithImage My QueryStringHelper class ......

Posted On Friday, May 16, 2008 2:48 PM

Function to Navigate To Named Anchor
Below is a helper function to insert javascript to Navigate To Named Anchor Page should have anchor with the passed name <a name="anchorName"></a... // from http://www.webdeveloper.com... ///<summary>/// ///</summary> ///<param name="page"></param> ///<param name="anchorName"></p... ///<remarks>Page should have anchor with the passed name <a name="anchorName"></a... /// If there are more than one call ......

Posted On Wednesday, May 14, 2008 2:28 PM

Using VS 2005 Web Setup Project Web Site porject - not user friendly process.
If you are working with Web Site porjects, VS 2005 Web Setup Project out-of-the-box is almost useless. The only option is to add content (including source code files). The recommended solution is to publish web project to create precompiled web application. Then you can add Procomiled site content to Web Setup Project. Note that you will see VS warning that precompiled Web Site is not recommended to be added to solution. When you will build Web Setup Project, the error will be shown Error 1 This ......

Posted On Friday, February 3, 2006 8:48 AM

Controls with the same name in GridView Templates
I've created the GridView with templates like the following: <asp:TemplateField SortExpression="Date1"> <AlternatingItemTemplate... <asp:CheckBox ID="chkSelected" runat="server" /> </AlternatingItemTemplat... </asp:TemplateField> <asp:TemplateField SortExpression="Date2"> <AlternatingItemTemplate... <asp:CheckBox ID="chkSelected" runat="server" /> </AlternatingItemTemplat... </asp:TemplateField> On runtime it cause the error: Message : Multiple ......

Posted On Monday, May 5, 2008 11:21 PM

Error: control with id ... could not be located or a different control is assigned to the same ID after postback
Our application has the intermittent (not too often,but can be 10-20 per day) errors like the following: An error has occurred because a control with id 'grdComplaints$ctl04$ctl00' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error. System.Web.UI.Page.ProcessP... postData, Boolean fBeforeLoad) +877 System.Web.UI.Page.ProcessR... ......

Posted On Monday, May 5, 2008 11:15 PM

Javascript to parse QueryString
I found couple code sample in Javascript to parse QueryString: Passing Parameters Via Query Strings The Read Function QueryString - get parameters from URL with JavaScript Is any in ASP.NET AJAX client library ......

Posted On Wednesday, April 23, 2008 8:46 PM

Do not allow user to view page using browser back button
// We never want the user to get back to this page via browser back // so prevent this from happening Response.Cache.SetCacheabil... There is also MS KB article, that shows How to retain only the most recent Web page state in the Web browser history folder. The latest (still in Beta) ASP.NET AJAX has ASP.NET 3.5 Extensions History Control Tip ......

Posted On Monday, April 14, 2008 5:49 PM

Use CommandField column to postback on GridView
I 've created GridView with HyperlLinkField columns. But I wanted to have link click to postback to the same page. I looked at some solutions like in a thread:GridView HyperLinkField with call to a javascript function It seems not working, I have a link as : <asp:HyperLinkField DataTextField="Field1" HeaderText="ID" SortExpression="Field1" NavigateUrl="javascript:ret... datanavigateurlfields="Fiel... target="_top"/> One of possible approaches described in Steps to ......

Posted On Wednesday, April 9, 2008 1:45 AM

Articles about Working with multiple checkboxes in GridView
I wanted to have multiple checkboxes in GridView . Below are a few links, that I've read before implemented my user control. Checking All CheckBoxes in a GridView Using Client-Side Script and a Check All CheckBox Storing and Maintaining DataGrid CheckBox Values - Selecting, Confirming & Deleting Multiple Checkbox Items In A DataGrid/GridView Implementing ITemplate as Anonymous Method Creating Web Server Control Templates Dynamically by implementing the ITemplate interface e.g. CheckBoxTemplate ......

Posted On Wednesday, March 19, 2008 12:16 AM

Validation of viewstate MAC failed when using asp.timer to trigger UpdatePanel
I have a page with UpdatePanel and ASP:Timer, that refreshs the UpdatePanel every minute. It was noticed that after new release after the first refresh any postback causes "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster." I've searched Google and found that this error is quite common. Below there are just a few suggestions: I do ......

Posted On Wednesday, March 19, 2008 12:09 AM

Create multi-row gridview Header with buttons in header
I found a few articles , that try to create multi-row gridview Header http://forums.asp.net/p/105... http://blogs.msdn.com/mattd... All solutions suggest to create extra DataViewRow(s) of a type DataControlRowType.Header on RowDataBound event. However on Postback DataBind usually is not called, and so RowDataBound event will not occur. It means that the second header will not be recreated on Postback -not good. Discussion GridView - trouble with double ......

Posted On Wednesday, March 5, 2008 11:50 PM

Unable to set Gridview HyperLinkField Header using DataBinding
I've tried to set Gridview HyperLinkField Header text to some value using DataBinding <%# Eval("Rating") %> ,but it caused error: 'Gridview :Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.H... does not have a DataBinding event. I had to assign Gridview HyperLinkField Header programmatically using RowDataBound event handler ......

Posted On Sunday, March 2, 2008 11:51 PM

Trace option for ASP.NET control will be useful to inspect event sequence.
Sometimes to understand sequence of events in ASP.NET page, it is useful to set @page TRACE="true" It shows(among other details) the sequence of page events and time that took each event to execute. However you can't request the same trace facility for user control events. You have to insert your own Trace.WriteLine (or similar) statements, which is quite annoying. I've posted the suggestion to MS Feedback site, but they do not want to implement it. Related articles that describe events and events ......

Posted On Thursday, February 28, 2008 11:57 PM

Function to get parent GridView for GridViewRow
A reference to the GridView can be obtained by using gridViewRow.Parent.Parent or (GridView) gridViewRow.NamingContainer... from here). So I've created the static function: public static GridView GetParentGridView(GridViewRow row) { //NOTE row.Parent doesn't return GridView GridView gridView = (GridView)row.NamingContainer; return gridView; } ......

Posted On Sunday, February 24, 2008 3:56 PM

Reduce use of HTTPS protocol as much as possible
I've noticed that some pages on our site were opened from my home computer with huge delay --more than 30sec, but others- almost instantly. The problem was with pages that use HTTPS(SSL protocol). It seams that my internet provider had performance problem, but it had huge impact on pages that was opened using SSL. In the normal development/test environment we never noticed the problem, but it could be a big issue for users with low bandwidth. We need to redesign our application to use https protocol ......

Posted On Friday, February 15, 2008 12:29 PM

How to detect Debug mode in JavaScript
I've asked a question on forum: AJAX ScriptManager Class has a IsDebuggingEnabled property, that is available in server code. I want in my client Javascript function to determine, do I running debug or release mode. MS Online Community Support suggested : You can create a hidden field to the page, then, check the IsDebuggingEnabled property of ScriptManager , if it is true, set the value of the hidden field to "true", else, false. It will work, but I expected the method available in some AJAX client ......

Posted On Wednesday, February 13, 2008 1:10 AM

How to use different client AJAX UpdatePanel error handling for different UpdatePanels?
I have an ASP.NET AJAX page with several UpdatePanels. If error occured during asyncronous postback, I want to ignore it for some panels and show errors for other updatepanels. The samples that I found(like Customizing Error Handling for ASP.NET UpdatePanel Controls.) suggested to call add_endRequest and from EndRequestEventArgs use error Property . Dave Ward suggested that In EndRequest, you can check sender._panelsToRefreshIDs. It’s a JavaScript array of UpdatePanel IDs being updated in the partial ......

Posted On Saturday, February 9, 2008 11:51 AM

Why DoPostBackWithOptions didn't work
I found that one of my ImageButtons stopped sending postback. I've noticed that it uses DoPostBackWithOptions. I remembered, that I had a problem when my page had PopupControlExtender and Validation controls(see.How do I get rid of DoPostBackWithOptions? ), but it was not a case this time. I've checked that it is nothing with IIS setting for handling ".axd" extensions - checkbox for "Check that File Exists" is unchecked! (see WebForm_ DoPostBackWithOptions not defined ). Finally I understood that ......

Posted On Wednesday, February 6, 2008 6:56 PM

ASP.NET Interview questions
I am involved in hiring an ASP.NET develover for our company. I found a few sites that listed interview questions. Below there are links that I found useful. http://srini-aspnet-tour.bl... (thanks to srini) http://www.hanselman.com/bl... (too complicated) http://www.hanselman.com/bl... http://www.megasolutions.ne... ......

Posted On Wednesday, February 6, 2008 12:01 AM

HTML ALT and title attributes -how to specify tooltip
I had a discussion about terminology used to specify tooltip. That what I found: ALT="..."--Specifies a text string to be displayed on browsers that do not support inline images.(from http://www.htmlgoodies.com/... ) Alt text is an alternative, not a tooltip- see http://www.456bereastreet.c... The alt and title attributes- see http://www.456bereastreet.c... ......

Posted On Tuesday, February 5, 2008 2:26 PM

Adaping CSS and Javascript from Html Prototype.
I've got from web designers HTML prototype, that I have to implement in ASP.NET web site. Just including the whole HTML with CSS and JS files didn't work well, because the CSS files had global settings, that corrupt existing layout. So I had to comment and modify CSS selectors to adapt th the site. Not an easy task, because I am not expert in CSS and it took a time to understand quite large set of CSS rules, that the designers used. Excellent presentation from Damian Edwards at RDN about CSS based ......

Posted On Friday, February 1, 2008 9:33 PM

Using Asp:menu and XmlDataSource
I've started to use Asp:menu with XmlDataSource based on Quick Start Example. To show many top level elements I tried to specify XPath, but failed to do it correctly(probably due to missing XML namespace). So I changed the XML schema aa suggested in Asp.Net Menu Control Binding with XMLDataSource and used XPath="/Home/Menu" to not show single root Item. Unfortunately DataBinding doesn't support default properties in XML file.All nodes must have all attributes, specified in DataBinding section. Otherwise ......

Posted On Wednesday, January 30, 2008 9:33 AM

Html Form inside ASP.Net page causes no postbacks
I needed to re-design an existing asp.net page to include new html, created by third party designer. After I've done the changes, I found that postbacks are not working. It took me a while to understand that the cause of the problem is an html form, included in the main ASP.Net form like the following: <form method="post" action="about/subscribe/" id="Mail"><input type="text" value="Enter your email address" name="mail" class="field-subscribe"/> <input type="image" align="middle" class="field-go" ......

Posted On Thursday, January 17, 2008 6:08 PM

Function to Strip Html Tags
I have a string that include HTML tags <B> font etc. I want to Strip Html Tags to show the string as tooltip. Thanks to HtmlAgilityPack it is easy: public static string StripHtmlTags(string html) { if(String.IsNullOrEmpty(html)) return ""; HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocumen... doc.LoadHtml(html); return doc.DocumentNode.InnerText; } ......

Posted On Wednesday, January 16, 2008 10:47 AM

TableCell.Text property is ignored if there are child controls
I wanted to dynamically create content of ASP.NET TableCell control. It should have some text and image. I've tried to use the code cell.Text = "Text"; cell.AddControls(imgControl); But the text wasn't shown. The reason is that if TableCell has child controls, the text value is ignored during rendering. See TableCell.RenderContents in Reflector. The valid way is the following: Label lbl=new Label(); lbl.Text=text; cell.Controls.Add(lbl); cell.AddControls(imgControl) ......

Posted On Thursday, January 10, 2008 11:03 AM

View html source in "Reporting Services" Report Design Preview

When I am using Report Design Preview in "Reporting Services" , I often want to view html source( in particular generated URLs), but Context Menu doesn't give me the option.
However I can select "Export/Web Archive" and save report as MHTML, than view it in IE. 

I feel that it is quicker than deploy the report to the server.

Posted On Thursday, January 3, 2008 10:51 AM

Call to parent-frame script causes "Permission Denied"
I have a frameset page that has two frames from different domains, and tried to call(from one frame) javascript function on parent page to change URL on other frame , but received Permission Denied The similar problem described in "Cross-frame scripting, works in FF but not IE" discussion. I made sure the "Navigate sub-frames across different domains" was enabled for all my zones http://news.hping.org/comp.... The scenario is of two different web servers. The parent ......

Posted On Thursday, November 29, 2007 7:35 PM

Javascript -dynamically change the width of one table based on the size of other table.
I need to ensure that the width of one table on my html page be calculated from the width of other table. (less for determined value). Currently the size is hardcoded in the Server user control code. But ideally it could be done using Javascript - to dynamically change the width of one table based on the size of other table. The Task looks very strightforward, but I decided to post a few links, that I found interesting: Dynamic Content with DOM-2 :JavaScript | Table and in particular Q1594 How can ......

Posted On Thursday, October 25, 2007 12:59 AM

DataView.Sort doesn't accept long name for direction
According to the documentation DataView.Sort is a string that contains the column name followed by "ASC" (ascending) or "DESC" (descending). Columns are sorted ascending by default. Multiple columns can be separated by commas. If you pass long name: Descending or Ascending (from System.Web.UI.WebControls.S... enum) the error is reported: System.IndexOutOfRangeExcep... Cannot find column LastName Descending. at System.Data.DataTable.Parse... sortString) at System.Data.DataView.Update... ......

Posted On Monday, October 22, 2007 8:06 PM

Code Render Blocks does not work inside HEAD server controls
I had a ASP.NET page with HEAD as server control similar to the following: <HEAD runat = "server"> <%this.RenderHeadItems()... <link rel="stylesheet" type="text/css" href="WebjetStyles.css?v=&l... </HEAD> The first server function was called and executed successfully, but the second Code Render Blocks located inside a parameter of link element, wasn't considered as server code and literally was copied to client HTML as &lt;%=AssemblyVersionNu... ......

Posted On Wednesday, November 14, 2007 12:17 AM

Ensure that JavaScript files or CSS files are refreshed for each new version
We can add into references to JS or CSS files from HTML: <SCRIPT TYPE="text/JavaScript " SRC="FileName.js?v=<%=As... The attribute does nothing other than trick the browser into thinking that the .js file must be retrieved from server for new version instead of cached . You can write your own AssemblyVersionNumber() function or use my function from My SystemHelper class. like the following: SystemHelper.GetAssemblyVer... Idea from ......

Posted On Friday, October 19, 2007 11:50 AM

DataGrid to GridView Conversion changes
I created a table describing, which fields/elements I had to change when converted existing DataGrid to GridView . Mapping for some other elements can be found in the article here. asp:DataGrid asp:GridView Comment asp:TemplateColumn asp:TemplateField asp:BoundColumn asp:BoundField AlternatingItemStyle AlternatingRowStyle ItemStyle RowStyle or TableItemStyle DataGridItemEventArgs GridViewRowEventArgs ItemDataBound event RowDataBound not DataBound DataGridItemEventHandler ItemCreated event RowCreated ......

Posted On Wednesday, October 17, 2007 3:06 PM

Custom DropDownList with DataBind and extra option "Please Select"
There is a common requirement to have DropDownList populated from Collection(e.g.DataTable) with extra (usually default) option "Please Select". I wanted to find a custom control that will allow to specify this extra option and use standard DataSource/DataBind. I wasn't able to find it in Google, so probably I will write it myself. Relevant links to consider:An ASP.NET 2.0 AutoComplete DropDownList... 'Dropdown1' has a SelectedValue which is invalid MetaBuilders.ComboBox[^] ......

Posted On Tuesday, October 16, 2007 10:39 AM

asp:PlaceHolder can be put within html table, if the table is not runat="server"
I had a table in user control, taht included asp:PlaceHolder. In the code some other user controls are loaded into the placeholder. <table cellSpacing="0" cellPadding="0" border="0" > <TR> <TD >Header</TD> </TR> <asp:PlaceHolder id="plc1" Runat="server"></asp:... <table> It worked fine until I decided make the table conditionally invisible based on some server logic. I've added an ID ans runat="server" to the table and got an error: System.Web.HttpCompileExcep... ......

Posted On Sunday, October 14, 2007 4:25 PM

NullReferenceException in EntitySpaces_C#_ASPX.csgen template after copy template instance
I am using MyGeneration Project to generate admin web pages using EntitySpaces Templates for ASP.NET . Filling templates is very time consuming, and I decided to copy template instance for one table as a start point for other table. It didn't save much , because it require you to do everything differently for each table anyway. And it also causes an errors. I've done selections im multiple tabs, but when I Executed template instances, I've got errors **ERROR*** [NullReferenceException] Object reference ......

Posted On Monday, October 8, 2007 7:35 PM

Generic LoadFromCache method to reliably read data from cache.
The typical procedure to work with cache is 1.to check if item for specified key exist in a cache; 2.if yes, return it; 3.if no, create it (e.g load from database), 4.save to the cache 5. and then return it. Some developers use the code like the following: If (DataCache.GetCache["key"] == null) { // code for loading object ... DataCache.SetCache("key", obj); } return DataCache.GetCache["key"]; //Not good, can cause problems (at least in ASP.Net 2.0). Sometimes SetCache is not effected immediately(or ......

Posted On Thursday, October 4, 2007 9:13 PM

To cache in asp.net individual items or one dictionary ?
I have a reference data, loaded from database table in ASP.NET application. I wanted to store some of the records in the cache, but only those that were called by some user, not the whole table. I considered to options: 1. to store individual items directly in the HttpRuntime.Cache dictionary with some composite string key(e.g. "MyTableName:"+ Row.Key.ToString()). 2. create new Dictionary<KeyType,Table... and add the loaded records to the Dictionary. The dictionary itself should be ......

Posted On Wednesday, October 3, 2007 10:29 AM

Creating composite controls using Html Designer.
In the current architecture od our application I have to use composite controls to implement significant amount of HTML UI. It will not be good to load child user controls into parent composite control(but technically probably still possible). I've followed the approach described in David Ebbo's Turning an ascx user control into a redistributable custom control blog post (and in MSDN article). However if you want to modify the control, process of Publish and copy DLL may be annoyed. I've decided ......

Posted On Friday, September 28, 2007 10:56 AM

Do not cache Web ListItems
In our ASP.NET application we have DropDownLists with standard values from reference data(e.g list of Countries). And we used Cache to avoid re-loading them from the database. The function was like the following: private void LoadItems() { ListItem[] cachedItems; cachedItems = GetAppCacheItems(); if (cachedItems == null) { //Load the reference data from the database omitted for simplicity SetAppCacheItems(cachedItems); } Items.Clear(); Items.AddRange(cachedItems); } And this method worked for a long ......

Posted On Friday, September 7, 2007 2:15 PM

ListItemCollection.AddRange sets selection to the first item
I have a custom DropDownList derived from System.Web.UI.WebControls.D... And I've noticed that after populating data using ListItemCollection.AddRange Method, the DropDownList.SelectedIndex Property becomes set to 0 from -1. I consider this as an unexpected behavior and have to change it back to -1- unselected. Items.Clear(); Debug.Assert(SelectedIndex == -1); Items.AddRange(cachedItems); Debug.Assert(SelectedIndex == 0);//is it correct ......

Posted On Wednesday, August 15, 2007 3:39 PM

Customize remoteoutlook Main Menu
Our company uses remoteoutlook fro MS Small Business Server 2003. It has Main Menu page, which has a few links, including access to SharePoint. We installed new SharePoint 3. on the different server., and I was asked to change links to a new sharepoint site. Outlook doesn't support this kind of customization out-of-the box. It uses ASp.NET web site with client.aspx file, showing Main Menu. But the actual code is compiled into Remote.dll storing in bin folder and is not available for modification(using ......

Posted On Thursday, August 2, 2007 11:17 PM

Function to validate Html Fragment
My code generate some dynamic HTML fragments and I want to know does the html valid. Thanks to HtmlAgilityPack it is easy: Debug.Assert(IsValidHtmlFra... public static bool IsValidHtmlFragment(string html) { HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocumen... doc.LoadHtml(html); return (doc.ParseErrors.Count==0); } ......

Posted On Thursday, July 26, 2007 5:52 PM

An error "An entry with the same key already exists" when assigning ImageButton.ImageUrl
We have the following code, ImageButton btn = buttonLookupTable[buttonName] as ImageButton; if (btn != null) { btn.ImageUrl = sUrl; } It is almost always works fine, but sometimes we've got the error: System.ArgumentException: An entry with the same key already exists. Stack Trace : at System.Collections.Speciali... key, Object value) at System.Collections.Speciali... key, Object value) at System.Web.UI.StateBag.Add(... key, Object value) at ......

Posted On Thursday, July 26, 2007 3:15 PM

ASP.NET Exception Handling links
There are a few articles about ASP.NET Exception Handling that I want to bookmark. User Friendly ASP.NET Exception Handling -very good library, in particular for logging Unhandled Exceptions in ASP.NET Web Services. Minor disadvantage is that it uses propriatory logging, not Enterprise Library Logging Block. Take Exception To Critical Errors With Custom Application Blocks shows how to use Enterprise Library to build an error-reporting framework and post them to remote web server. Article Rich Custom ......

Posted On Tuesday, June 26, 2007 3:47 PM

Passing Exception details in Session to Custom Error page.
In my recent post ASP.NET Exception Handling links I wondered why in the article Rich Custom Error Handling with ASP.NET Session is not considered to pass Exception details between global.asax: Application_Error and Rich Custom Error Pages with Redirect method. The article compare different state possibilities : Application, Context, Cookies, and QueryString. The application that I am working with used Cache(which technically works as the same way as Application) with SessionID as a key and Response.Redirect() ......

Posted On Friday, July 20, 2007 12:22 AM

WatiN testing of multi-level Frames page
I wanted to use WatiN Web Application Testing In .Net, to test html page with multi-level frames: E.g TopFrame.aspx : <Frameset> <FRAME SRC="ContentFrame.aspx"> </Frameset> ContentFrame.aspx <body> <IFRAME SRC="SubFrame.aspx"> </body> When I tried to check ie.Frame("ContentFrame") it didn't show me html of ContentFrame.aspx(as expected), but showed html of parent TopFrame.aspx. I've attached debug version of WatiN and stepped through to opening page. And in debugger ......

Posted On Friday, June 29, 2007 1:39 PM

Tools to debug/Trace ASP.NET applications.
I personally hate to open blogs, that just have list of links without more useful information. But as I wrote in Ways to store bookmarks/favorites post, blog is a convinient way to save favorites. So I will just save links for now, and hopefully will add more comments about them later. FIDDLER supports HTTPS, ensure that "Capture HTTPS Connects" and "Decrypting HTTPS traffic" are ticked in in "Fiddler options". However running Fiddler in "https mode" can have side effects, e.g. my connection to TFs ......

Posted On Thursday, June 21, 2007 11:38 PM

Unit Testing ASP.NET Applications
I will put a few links related to ASP.NET unit testing. WATIN Initially I saw reference to WATIR from Scott Hanselman's post Integrating Ruby and Watir with NUnit . Recently I've found WatiN Web Application Testing In .Net, including articles WatiN - Web Application Testing In .Net - The Code Project - ASP.NET and WatiN Test Recorder - The Code Project .(The home page for WatiN Test Recorder is here) There is interesting article by Jeremy D. Miller with comment from ScottGu recommending WatiN . Using ......

Posted On Wednesday, June 20, 2007 2:12 AM

Dynamic menu in ASP.NET 1.1.
My friend asked me, how to built dynamic 2 -lelels menu in VS 2003. Items coming from database amd mainly are hyperlinks to HTML document. I haven't written myself dynamic menu in ASP.NET. My application was based on DotNetNuke and used DNNMenu See http://webcontrols.dotnetnu... However I am not sure, is it possible to use it stand-alone without DNN. The author of DNNMenu Jon Henning had separate SolPart menu ,but unfortunately the link In ASP.NET 2.0 there is standard Menu Control ......

Posted On Friday, May 25, 2007 12:10 AM

Start Transaction from ASP.Net application can cause unexpected locks on the database.
I have the ASP.Net application, that uses SqlTransaction.BeginTransac... before the call to Update SP and commit after the call.If any exception would happened, transaction should be Rollback. The code snippet is the following: conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { try { ds = SqlHelper.ExecuteDataset(tr... CommandType.StoredProcedure, SPName); trans.Commit(); } catch (Exception ex) { trans.Rollback(); //Log the error } } We noticed that during update of web.config ......

Posted On Wednesday, May 16, 2007 2:25 AM

Schedule/Calendar Asp.NET controls with Source Code
I wanted to find a Schedule Asp.NET control with Source Code as astart point for my development. I found in CodeProject , but they have LGPL license,that is not acceptable in my commercial application DayPilot Pro looks the most closed to what we need,in particular combination of http://www.daypilot.org/dem... and http://www.daypilot.org/dem... Intersting sections to extend functionality is Custom event rendering . ComponentOne WebSchedule for ASP.NET looks nice, ......

Posted On Tuesday, May 8, 2007 4:17 PM

ASP.Net Ajax UpdatePanel links.
I've tried to investigate slow load of UpdatePanel. It works quick enough in FireFox, slow in IE 7 and even more slower in IE6. I found a few related links: In production make sure that <compilation debug="false"> is in your web.config(tip from http://forums.asp.net/threa... Delayed load with an UpdatePanel and similar post. The top 10 mistakes when using AJAX recommends do not put everything in a UpdatePanel. "Are you making these 3 common ASP.NET AJAX mistakes?" suggest to use ......

Posted On Monday, May 7, 2007 12:59 AM

In ASP.Net Application_Error avoid call to web service on the same web application.
In my ASP.NET application I had global event handler Application_Error, that called Web Service(via WS client proxy class) to log the error. The actual web service ASMX file belongs to the same application.I knew that it is better to call method directly, without extra layers, but function to call Web Service were located in Business Layer DLL, that also was used by Desktop Client, so I considered that it is acceptable overhead. However, when an error occured on an early stage, when ASP.NET application ......

Posted On Thursday, March 15, 2007 10:59 AM

Possible errors when using Web Setup project to upgrade version, that was XCopied
I am using Web Setup project to install Web Site Project(customized version of DotNetNuke). It installs a lot of DLL with meaningless names(like App_Web_42q_drww.dll) into BIN directory.If user upgrades later to the new version of the project MSI installer seems smart enough to delete old DLLs and install another set of DLLs with different unfriendly names.The problem happens if site to upgrade wasn't installed using Web Setup MSI, but was XCopied.The sample scenario is the following:An administrator ......

Posted On Wednesday, March 14, 2007 4:35 PM

Explicitely specify Default user credentials for Proxy Server.
Some time ago I wrote post "Call Web Services through SQuid proxy server with authentication requested" and hoped, that I will not have more problems with Squid web proxy server. However the solution wasn't sufficient for other site. I've tried a lot of things, started thread "Unable to access external web sites through Squid proxy server with required authentication." and posted suggestion to Microsoft "Add ability to specify credentials to defaultProxy configuration element". But the best solution, ......

Posted On Friday, March 9, 2007 12:18 PM

legacyUnhandledExceptionPolicy enabled="true" doesn't prevent ASP.NET application restarting
We have an ASP.NET application in production(running IIS6 on Windows 2003 server) that sometimes has ".NET Runtime 2.0 Error Reporting" due to exceptions in background threads. We wanted to ignore the errors(while we will fix the cause) and specified <runtime> <legacyUnhandledExceptio... enabled="true" /> </runtime> in application web.config(as it is suggested in MSDN). Unfortunately it didn't help- ASP.NET application still keep restarting, which causes "session expired" behavior.I ......

Posted On Friday, March 9, 2007 9:12 AM

If DefaultProxy address is not specified in config file, GetProxy returns unchanged URL
I found in debugger that when I am using static WebRequest.DefaultWebProxy and there is no proxy address specified in the config file, IWebProxy.GetProxy returns the same address, as it was passed. IWebProxy iDefaultWebProxy = WebRequest.DefaultWebProxy; Uri uriProxy = iDefaultWebProxy.GetProxy( I haven't seen this in documentation, but the thread confirms the behavior. new Uri(ws.Url)); if (sProxyUrl == ws.Url) {//no proxy specified } ......

Posted On Wednesday, March 7, 2007 3:42 PM

Always use UrlEncode, when passing parameters to Url string
I had a function, that took the field BARCODE from the database and created URL string for Redirect with parameter ?barcode=BarcodeValue. It worked fine for a while, because most of values were numeric or alpha-numeric. However when barcode has 'plus' sign in front, e.g '+2134214', on the target page Request.QueryString("Barcode") replaces the 'plus' sign with space and returns ' 2134214' ,which is obviously not expected So the correct way to code is to use HttpUtility.UrlEncode , if characters such ......

Posted On Tuesday, March 6, 2007 12:19 PM

GridView with inline inserts -different implementations.
I wanted to use GridView with inline inserts capability. Unfortunately it is not available out-of-the-box. I found Code Project's “ASP.NET GridView - Add a new record“ , but I don't like an idea to create dummy empty row as the first line in the DataSource. Another Code Project's GridView Redux article seems uses the same approach. I've tried “Real World GridView” , but it doesn't populate DropDownField with the List Values for Insert rows. The most promising looks Fredrik Normén's Use the GridView ......

Posted On Saturday, September 2, 2006 11:05 AM

"VB Master-Details Insert" QuickStart sample should work for empty table.
I've used VB Master-Details Insert QuickStart sample in my application.It works relatively good(if ignore System.InvalidOperationExce... ObjectDataSource '...' could not find a non-generic method 'Update' that has parameters error).However to create a new record,you need to have DetailsView visible. However if the GridView is empty, DetailsView is not visible and user is uable to create the first record. I've added code to show DetailsView in DefaultMode="Insert" if no data was selected in the ......

Posted On Thursday, March 1, 2007 9:25 PM

Why we are getting ObjectDataSource: could not find a non-generic method 'Update'.
I've hit the same problem again. I've already wrote 2 posts about the error "Exception Details: System.InvalidOperationExce... ObjectDataSource 'ods' could not find a non-generic method 'Update' that has parameters: ...." ( Editable GridView with ObjectDatasource and Update method parameters. and Some workaround for ObjectDataSource: could not find a non-generic method '...' .) And these posts are the most popular in my blog according to views statistics. Not because they are very useful - just ......

Posted On Thursday, March 1, 2007 6:58 PM

"Configure Data Source" Wizard reads assemblies from BIN directory regardless of specified Build Output Path in VB WAP project
Today I wanted to add Object Data Source(located in another DLL) to User Control in VB WAP project."Configure Data Source"Wizard showed me "Choose your Business Object" drop-down list with some objects from my DLL, but not the newest, that I've created recently. I've rebuild my projects a few times,cleaned solution,closed and re-opened Visua Studio -it didn't help. My new data classes were not included in the combo-box. When I added class typemanually in the markup view, Wizard reported, that class ......

Posted On Friday, February 9, 2007 8:04 PM

Parser Error Message: Access to the path is denied. caused by SourceSafe merge.
I've used Visual SourceSafe Merge method to merge changes from different brunches of the ASP.NET site project. VSS created merged file, as well as renamed original file with .org extension. (By the way, it is not widely known, that VSS creates a backup copy of the original file filename.ext.ORG, that can be used to restore file, if merge unsucceded by some reason). However when I started to run the ASP.NET application in IIS, it caused "Access to the path" errors, e.g. Parser Error Message: Access ......

Posted On Thursday, January 4, 2007 11:24 AM

Visual Studio 2005 SP1: Unable to detach from one or more processes
I've just updated VS 2005 to SP1. I am using WAP project with DevServer and enabled "Edit and Continue". My common procedure is to start debugging session, do the changes in the code if required, and if the code is blocked by VS(very annoying, but MS doesn't want to fix it) ,I detaching the debugger from the project. In SP1 it started to show error:Unable to detach from one or more processes. Operation not supported. Unknown error: 0x80131c32.It is not always reproducible, but happened a few times ......

Posted On Thursday, December 28, 2006 7:45 AM

Code Generator for ASP.NET application
I had a requirement to find Code Generator that will help to port existing quite big fat client application to ASP.NET and to support multiple databases. The codegeneration.net site provides quite a big list of applications that claims to do this. I also was pointed by Paul Wilson's posts (How do you decide what features to add or cut?, Debate: O/R Mapping or Code Generation and others) that Dynamic SQLs in O/R mappers allow to avoid hundreds of CRUD stored procedures and DAL classes.Unfortunately, ......

Posted On Wednesday, December 20, 2006 3:56 PM

Function to bind Generic Dictionary with dropdown list.
With the tip from the post How to bind Generic Dictionary with dropdown list I've created the static method: //'http://blogs.msdn.com/pi... public static void ControlBinding(ListControl ctrl, Dictionary<string, string> dict) { ctrl.DataSource = dict; ctrl.DataValueField = "Key"; ctrl.DataTextField= "Value"; } //Overload for StringDictionary public static void ControlBinding(ListControl ctrl, StringDictionary dict) { ......

Posted On Tuesday, December 19, 2006 2:21 PM

Multiple SCOPE folders in WEBDAV folder queries.
I am using WebDAV queries against Exchange Public queries. Because MAPI folders do not support deep traverse, I've used Multiple Folders as it is shown in MSDN : SELECT "DAV:displayname"FROM SCOPE('shallow traversal of "http://myserver/public"', 'shallow traversal of "http://myserver/public/use... 'shallow traversal of "http://myserver/public/use... And I beleive that it worked against Exchange 2000 (I couldn't confirm it, because I have now only Excahge 2003 available). But ......

Posted On Thursday, November 2, 2006 1:31 PM

Invoke Executable as custom action during Install.
I've used MS Installer class to provide custom actions during setup in a few projects(e.g.see Using VS 2005 Web Setup Project with custom actions).However if you have some complex logic to do as a part of setup, it is possible that some exception will occur. I don't like to hide exceptions, and they are shown to the user,causing installation to rollback. It is not good, becuse sometimes user wants to ignore exception and use installation even if some custom action failed.I found that moving code ......

Posted On Monday, October 23, 2006 11:14 PM

Side effect of debugging ClientID in DataGrid ChildTable.
I am using Metabuilders ExpandingButtons and started to get “Please check the page configuration“ error. Some investigation showed that my DataGrid control has two IDs, one as expected from ServerID and another with suffix “__Ctl0”. <table id="dnn_ctr374_ResultsConta... cellspacing="2" cellpadding="2" border="0" id="dnn_ctr374_ResultsConta... JavaScript from ExpandingButtons ......

Posted On Thursday, October 12, 2006 8:55 PM

ASP.NET CheckBox inside Datagrid returns Checked=false in Postback, if the column is not visible.
In one of ASP.NET pages I've used CheckBox column inside Datagrid, and on some condition the column containing checkbox was invisible TemplateColumn.Visible=false On postback my code tried to read if control is checked, and it always returned chk.Checked=false. It seems that it is done by design and invisible CheckBox does not have ViewState["Checked"]. As it suggested in the link Invisible column won't be rendered to the client.(http://www.velocity... ......

Posted On Wednesday, October 11, 2006 11:06 AM

Unreliable in ASP.NET 2.0 Cache usage in MetaBuilders.DialogWindow
I am using MetaBuilders.DialogWindow[^] and recently got System.NullReferenceException: Object reference not set to an instance of an object.at MetaBuilders.WebControls.Di... . Investigation of the code showed that the problem related to the changed in ASP.NET 2.0 Cashe behavior - asyncronous Insert. if ( context.Cache[cacheKey] == null ) { context.Cache.Insert(cacheKey, DetermineIsRegistered()); } return (Boolean)context.Cache[cach... similar problem was known ......

Posted On Wednesday, September 20, 2006 7:55 AM

Nested Data Bound UserControl
I needed to have ASP.NET report with DataRepeater and nested data bound user control.The similar approach is used in ASP.NET Reports Starter Kit with datagrid nested in datalist itemtemplate. <asp:datalist id="CategoriesList" runat="server" > <itemtemplate> <asp:datagrid id=Datagrid1 runat="server" DataSource=''<%# GetDetails(DataBinder.Eval(... "CategoryID")) %>' </< FONT>asp:datagrid> </< FONT>itemtemplate> <headerstyle cssclass="ReportTitle">&... ......

Posted On Saturday, September 16, 2006 12:41 PM

Batch to Logging Worker Process Recycling Events in IIS 6.
I want to log Worker Process Recycling Events in IIS 6.0 (IIS 6.0) , but ther is no UI for this. I've created batch file and decided to post it here, because current instructions have a few typos.You should modify value of AppPoolName as appropriate. :rem IISLoggingWorkerProcessRecy... from http://www.microsoft.com/te... EnableEvent=trueset AppPoolName=ASP.NET v2.0%systemDRIVE%cd %systemDRIVE%\inetpub\admin... ......

Posted On Friday, September 15, 2006 8:27 AM

Call Web Services through SQuid proxy server with authentication requested
My ASP.NET application calls web services( including Google Web API) and it is a requirement to access it through Proxy Server that requires Authentication. It works correctly with Microsoft ISA server (see my post Set defaultProxy configuration Element for Proxy Server) . But it didn't work with Squid proxy server Authentication. When I specified useDefaultCredentials=true, the WebException returned : “HTTP status 417: Unknown“.After some investigation I found that 417 is actually Expectation failed ......

Posted On Wednesday, September 13, 2006 11:06 AM

Retry to call Web Service in case of "The remote name could not be resolved" error.
I found that sometimes, if I have an error "The remote name could not be resolved" to access remote web services, I should re-try the call and it helps.I've considered to increase timeout for WebServices method call, but some methods,e.g. DataSet.ReadXml (String) doesn't have the option. So I've created a static method that will retry remote call a few times. The actual function to call can be passed as delegate: public class WSClientHelper { public delegate void CallWebServiceDelegate (); public ......

Posted On Thursday, September 7, 2006 12:52 PM

Editable GridView with ObjectDatasource and Update method parameters.
Recently I posted Some workaround for ObjectDataSource: could not find a non-generic method '...' . Sinse that I done some investigation to understand better the reason of the problem and possible workarounds. Most of them are posted in thread “Dataset + ObjectDatasource + GridView + ASP.NET 2” .The problem perfectly described here. And it is reported to MS, but they don't want to address it. Actually Update code trying to executeby ASP.NET from ObjectDataSource very depends on fields and field properties, ......

Posted On Friday, September 1, 2006 10:32 AM

Access to BoundField value when GridView row is selected.
I have a GridView with BoundField , and I want to access it value when GridView row is selected: <asp:GridView ID="grvCascadeRulesTemplates" runat="server" AutoGenerateColumns="False" DataKeyNames="CascadeRuleKey" DataSourceID="odsCascadeRul... <Columns> <asp:CommandField ShowSelectButton="True" SelectText="Show Values">asp:CommandField... <asp:BoundField DataField="CascadeRuleKey" HeaderText="CascadeRuleKey" ReadOnly="True" SortExpression="CascadeRule... /> <asp:BoundField ......

Posted On Thursday, August 31, 2006 2:13 PM

Some workaround for ObjectDataSource: could not find a non-generic method '...'
I tried to use generated by VS 2005 typed dataset/adaptors with ObjectDataSource and got am error: Exception Details: System.InvalidOperationExce... ObjectDataSource 'odsCascadeRulesValues' could not find a non-generic method 'Update' that has parameters: .... I found the thread that suggested some workarounds, but the simple one “Change this OldValuesParameterFormatStr... to OldValuesParameterFormatStr... didn't work for me.I've found that the problem only happened if your ......

Posted On Wednesday, August 30, 2006 3:16 PM

Dynamically add User Control to other ASP.NET controls children list.
I wanted to dynamically add my user control as a child to another control. I've used the code with new constructor, as I did for standard ASP.NET server controls and custom controls. Dim ctrlInstances As SearchAreasInstancesUsc = new SearchAreasInstancesUsc() 'Incorrect tCell.Controls.Add(ctrlInst... Then I found that declaratively defined( in ASCX markup) controls are not initialized and set to null. Of course, I should LoadControl to allow ASP.NET to initialize all declarations. Dim ctrlInstances ......

Posted On Wednesday, August 16, 2006 1:56 PM

Refresh data in ObjectDataSource in button event handler
I have a user control with GridView and ObjectDataSource. I also have a button, that should update database and I wanted to refresh GridView in the same click callback. And it's easy to do- call ObjectDataSource.Select and then GridView.DataBind: Protected Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click ‘method to update database is omitted for simplicity Me.ObjectDataSource1.Select() Me.GridView1.DataBind() End Sub Update: As I was adviced by Bob Riley, ......

Posted On Wednesday, August 2, 2006 3:57 PM

How to precompile-in-place ASP.Net 2 web site, that has been deployed with "Updatable precompilation" ?
I have a scenario. Developer choose Updatable precompilation for deployment that retained the markup in Web UI content pages but moves source vb/c# code to bin dlls. Production administrator wants to avoid the performance hit on the first request and wants to run in-place pre-compilation to forces all pages in the application to compile. The problem is that aspnet_compiler fails to pre-compile “in-place”, reporting that the site is already pre-compiled. I am looking for any workaround ......

Posted On Monday, March 13, 2006 6:05 AM

Using appSettings external file with "Publish Web Site" option - add exclude extension.
In ASP.NET 1.1 i've used appSettings file="DevSettings.config" to specify an external file that contained custom application configuration settings. DevSettings.config wasn't included in the project and was not copied to the production sites. In VS 2005 all files are included in the project and "Publish Web Site" command copies to production all files , including those that I don't want to copy. But there is a simple solution - change the name of the file DevSettings.config to DevSettings.config.exclude. ......

Posted On Thursday, February 9, 2006 11:09 AM

Intermittent WebException "The remote name could not be resolved" -try a few times.
I've noticed that one of web services, that I am using sometimes(usually at the first attempt) returns WebException "The remote name could not be resolved".I've desided to include re-try code in my call and it made my application more reliable: // I beleive that it's a good idea to re-try in case of "The remote name could not be resolved" for (int i = 0; i < 3; i++) { try { //call web service ds = ReadRssUrlAsDataSet(timeStart, url); break; } catch (WebException exc) { if (exc.Message.Contains("The ......

Posted On Monday, August 14, 2006 9:38 AM

How to open web.config file from custom action installer class, located in DLL.
One of the readers of the my post "Using VS 2005 Web Setup Project with custom actions" asked how to pick web.config file. that is actually part of the web project, from custom action installer class located in a separate DLL. With an assumption that DLL with installer class located in the BIN folder of the web project , you can do the following: Dim asm As System.Reflection.Assembly = System.Reflection.Assembly.... sConfigFileName As String = FSHelperLib.AppSettingsHelp... ......

Posted On Monday, August 14, 2006 9:13 AM

Using Web Application Project(WAP) for development of DotNetNuke modules with Edit and Continue Support
I am using Web Application Project(WAP) for development of DotNetNuke modules. The general approach is discussed in DNN forum thread here. My VS solution consists of main WAP Project and one or more User Control Libraries similar to described in Tutorial 6: Creating and Using User Control Libraries. The main WAP Project basically includes one DNNDebug.aspx file (as well as web.config and global.asax), that allows me to load and test my user controls. The User Control Libraries(DNN modules) are physically ......

Posted On Tuesday, August 8, 2006 9:04 PM

Debug helper functions for Regex/Match classes
I've created debug functions PrintMatch, PrintMatchCollection and PrintRegexGroups that allowed to output information from Regular Expression classes, that not always easy to view in debugger. They are included in my Utility to Remove CodeBehind attribute From Ascx files that helps to use WAP User Control Libraries from Web Site Project. ......

Posted On Friday, August 4, 2006 4:53 PM

Event sequence for ASP.NET user control with ObjectDataSource
I've started to work with ObjectDataSource and had a question about event sequence for it. I didn't find specific documentation and added event handlers with DebugHelper.TracedLine calls (you can use just simple Debug.WriteLiine). The result was quite logical:Page_Load (IsPostBack =False)ObjectDataSource1_Lo... user clicked on Select buttonPage_Load (IsPostBack ......

Posted On Wednesday, August 2, 2006 7:45 AM

use VS 2005 or VS 2003 due to VS 2005 slowness?
One reader of my post “How to fix "Visual Studio 2005 is very slow" problem -no solution so far“ asked me should he use VS 2005 or VS 2003: “We recently moved from VB6 environment to .net. We started our project in VS 2005 , asp.2.0 . But the issue is VS 2005 is VERY Slow on our computers. My Team members are getting frustrated. I increased the Ram to 1 GB... still no significant improvement! (yet to implement the hot fix).” I've posted his questions and my answers here: 1) ......

Posted On Wednesday, July 19, 2006 10:37 AM

How to refer to parent DataGrid from DataGridItem - use NamingContainer
It's published in a few places, but I had to do a few Google searches before confirming that you should use NamingContainer property to get parent DataGrid for DataGridItem. So I've created a shared method in my WebFormsHelper class. Public Shared Function ParentDataGrid(ByVal Item As DataGridItem) As DataGrid ' Dim gridTable As DataGridTable = Item.Parent 'DataGrid = gridTable.Parent doesn't work because MS declared DataGridTable as private(why?) Dim grid As DataGrid = Item.NamingContainer Return ......

Posted On Tuesday, July 18, 2006 8:47 AM

HyperLink for files with spaces in the path not working in Internet Explorer.
I was using asp:hyperlink control to show links to local LAN files , e.g. <asp:HyperLink ID="lnkToClick" runat="server">link to LAN fileasp:HyperLink> Me.lnkToClick.NavigateUrl = “file://\\Server\Folder\Fil... It worked fine, unless Folder path or filename has spaces in it(Probably other special character could cause the same problem). In this case, generated html file has %20 instead of space and clicking on the generated link in IE doesn't open file. In othe words Internet Explorer ......

Posted On Friday, July 14, 2006 11:16 AM

my DebugHelper and TraceHelper classes
I've posted a few code snippets and some people noticed that there are references to unresolved methods. I am using a few helper classes. This post describes my DebugHelper and TraceHelper classes. namespace FSHelperLib { using Microsoft.VisualBasic; using Microsoft.VisualBasic.Compi... using System; using System.Collections; using System.Data; using System.Data.SqlClient; using System.Diagnostics; using System.Collections.Specialized ; using System.IO; using System.Net; using System.Runtime.CompilerServ... ......

Posted On Thursday, July 13, 2006 8:13 AM

Unreadable characters in Web Services string parameter can cause HTTP status 400: Bad Request
I have a web service that sends USMARC record as string. USMARC uses unreadable characters Chr(29)/Chr(30)/Chr(31) as separators. MS web services XMLSerializer doesn't encode these characters and causes System.Net.WebException: "The request failed with HTTP status 400: Bad Request".Interesting to note that the error not happened if test the operation using the HTTP POST protocol or if a string is incorporated into Dataset record.I am using simple Encode/Decode functions to workaround the issue. TODO: ......

Posted On Thursday, July 6, 2006 3:16 PM

Set a property for ISSWebFile in subfolder.
Recently I posted class that I am using to Programmatically set IIS Authentication for a page. Later I found that initial implementation almost never worked because files in subfolders usually do not have explicit entries in the metabase, but inherit all properties from the parent. I've added code to create metabase entry (similar to this). But if the file is in subfolder, not in the virtual directory, adding the SchemaClassNames="IIsWebFile" doesn't work (see discussion Creating Virtual Directories ......

Posted On Friday, June 16, 2006 9:01 AM

Check that embedded resource exist before calling ClientScript.RegisterClientScriptResource or GetWebResourceUrl
The Asp.NET 2.0 allows to provide JS files in embedded resources using WebResource.axd. The procedure is well described here and here. Note that adding [assembly: WebResourceAttribute] attibute is important. However the methods ClientScript.RegisterClient... and ClientScript.GetWebResourceUrl do not throw exceptions, if embedded resource is missing. They just generate invalid urls that can't be visually checked because parameters are encrypted. For easier identification of the error it ......

Posted On Friday, May 26, 2006 10:21 AM

Installing ASP.NET 2.0 Application -ensure that it runs ASP.Net 2.0
For my Web Setup (created by MS Visual Studio Setup Project) I wanted to ensure that a new web application runs ASP.Net 2.0. Pointed by this thread, I downloaded "IIS Chameleon". I've changed the assembly toDLL, excluded Non GUI classes, made ASPNetVersion,INETMGRHelper and CURRENT_RUNTIME_VERSION public and also changed definitions.xml to be embedded resource(may be not a good idea, because it will not allow to customize, but easier to distribute). I also changed GetAllASPNETVersions to read from ......

Posted On Thursday, April 27, 2006 1:09 PM

Data change checking features in DotNetNuke pages.
I've used data change checking features described by Eric Woodruff in my ASP.NET application. When I converted the ASP.NET application to DotNetNuke, I still needed to have the same functionality. Unfortunately .Net doesn't allow multiple inheritanse, so I had to re-factor EWSoftware.Web.BasePage. I created an interface IDataChangeChecking, that described the public methods, relevant to data change checking://described in http://www.codeproject.com/... BypassPromptIdsbool ......

Posted On Thursday, April 20, 2006 2:30 PM

Emailable DotNetNuke Module
I've used an e-Mailable ASP.Net web page described by Eric Woodruff in an ASP.NET application. When I converted the ASP.NET application to DotNetNuke, I still wanted to have the same functionality-ability to e-mail rendered content of the DotNetNuke module. I created the class EmailableModule based on DotNetNuke.Entities.Modules... and copied and paste the content of EMailPage class. There are a few places where I changed references to page to references to DNN module.I was able to ......

Posted On Tuesday, April 4, 2006 8:40 AM

Parameters for WebConfigurationManager.OpenWebConfiguration(RootVDir, SiteNumber)
I needed to open web.config file from the external application(setup utility). I decided to use WebConfigurationManager.Ope... function. In the documentation it is not clear, that path should started with “\“ , e.g “\MyWebApp“.Passing “MyWebApp“ without leading “\” causes error. If I want to use metabase site path (e.g "/LM/W3SVC/1") instead of name of the application Web site, I can to pass “1“ as site parameter and it is fully acceptable(but not documented) ......

Posted On Tuesday, March 28, 2006 12:27 PM

MetaBuilders.ComboBox compile with Visual Studio 2005
I am using MetaBuilders.ComboBox[^] (see my previos posts here and here) and now compiled it with VS 2005.New compiler is more strict . It showed couple compiler errors “Cannot access protected member 'System.Web.UI.WebControls.... via a qualifier of type 'System.Web.UI.WebControls.... the qualifier must be of type 'MetaBuilders.WebControls.C... (or derived from it)“ for code linescontainer = new WebControl(); andbutton = new WebControl(); Fortunately ......

Posted On Friday, March 24, 2006 10:06 AM

FreeTextBox editor requires IE permission "Allow Paste Operation via script" to support Paste with Control-V.
Many sites including DotNetNuke are using FreeTextBox ASP.NET HTML Editor. I've noticed that on my Windows Server 2003 machine running IE I am not able to do Control-V to paste text to the editor, even if I can right-mouse click and select “Paste” . It was quite annoying. Accidentally I found that IE permission "Allow Paste Operation via script" is disabled on this machine. I've enabled it and now I can use Control-V to paste. I am not sure which security risks are envolved with enabling ......

Posted On Thursday, March 16, 2006 6:47 AM

Can't assign text to DotNetNuke LabelControl in Page_Load event.
I wanted to assign text of the LabelControl , so in the user control Page_Load function I've added code like this: If Page.IsPostBack = False Then If bSetCaptionInCode Then Me.plUsername.Text = "Your User NAME:“ end if End If Unfortunutely, it didn't work and the label was not changed. After some research I found , that LabelControl's text is populated from resources during LabelControl's Load event , which is later than container UserControl Load event. So if I want to overwrite text from ......

Posted On Wednesday, March 8, 2006 2:33 PM

Set defaultProxy configuration Element for Proxy Server
Some customers of our application have ISA Server that requires Proxy Authentication. When ASP.NET applcicationed called external web services (e.g. Google APIs) it caused the error: The request failed with HTTP status 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. ). In .Net 1/1.1. it was required to set in code myProxy.Credentials = CredentialCache.DefaultCred... . Now in .Net 2. there is a new defaultProxy ......

Posted On Wednesday, March 8, 2006 11:19 AM

Dynamic Web Services reference URL in Visual Studio 2005
I am using dynamic URLBehavior for some web services and during Setup change web services URLs to appropriate value (based on MSDN article). According to MSDN2: If you set the URL behavior of the Web reference to dynamic, the application obtains the URL at run time from the appSettings element of your application's configuration file. However I've noticed that app.config file has entries for the same URL in both appSettings and <applicationSettings>. After reading the generated code (Reference.vb/cs) ......

Posted On Friday, February 24, 2006 9:01 AM

"Visual Studio 2005 is very slow" -some tips for ASP.NET projects
I am very disappointed with performance of VS 2005, in particular when building ASP.NET web site projects. I've tried a lot of suggestions. 1.Workaround Description: Delete windows.prf & windowsidx.prf from C:\Documents and Settings\\Application Data\Microsoft\Visual Studio\8.0\ . Seems has no effect. 2 Uncheck Navigation bar. 3.Disable wordwrap at: Tools>Options>TextEditor >C#>General4. My project had referenced DLLs located on shared folder on remote computer. When I moved DLLs ......

Posted On Tuesday, February 21, 2006 8:14 AM

Error "Unrecognized attribute 'requirePermission'" after publishing Web Site.
I had a working DotNetNuke project 4.0.2 with .Net 2.0 that I wanted to publish to Windows Server 2003. However when I opened the published web site, I've got an error: Parser Error Message: Unrecognized attribute 'requirePermission'.Source Error: Line 4: <sectionGroup name="dotnetnuke"> Line 5: <!-- the requirePermission attribute will cause a syntax warning - please ignore - it is required for Medium Trust support --> Line 6: <section name="data" requirePermission="false" type="DotNetNuke.Framework.... ......

Posted On Friday, February 3, 2006 5:57 AM

Parsing web.config with XmlDocument.SelectSingleNode
I have an utility that modified ASP.NET web.config using code like this: XmlDocument document = new XmlDocument();document.Load... nodeParent = document.SelectSingleNode("... I found that this code doesn't work with VS 2005 (SelectSingleNode returns null) because configuration element has xmlns <configuration xmlns="http://schemas.micro... . I was able to delete xmlns attribute without any visible side effects to make ......

Posted On Thursday, February 2, 2006 1:17 PM

Using VS 2005 Web Setup Project with custom actions
I've used VS 2003 Web Setup Project with custom actions and Installer class. that did some changes. After moving to VS 2005 I found that it is not possible to invoke custom action for DLL because only content output is available. The post suggested to use VS 2005 Web Deployment Project . However in my case compile failed with the very helpful Aspnet_merge.exe Exited With Code 1. Some posts explain that the error comes from duplicate class names in the project, even if the name comes from different ......

Posted On Thursday, February 2, 2006 12:02 PM

Visual Studio 2005 Web Site Project- "Edit and Continue" is too restrictive.
I have a solution with Start ASP.NET project and several VB and C# library projects. When I stopped in Visual Studio 2005 debugger in the library class code, the file is shown with small “lock”. It doesn't allow me to do any changes, but show the message "Edit and Continue" "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged is optimized". None of of these conditions is actually applicable for my case. Library is included in the solution, ......

Posted On Monday, January 9, 2006 10:59 AM

Resolved :.NET Runtime version 1.1.4322.2300- Setup Error: Failed to load resources from resource file
On a windows 2003 server (IIS6) from some time when I tried to open ASP.NET application I started to receive error: .NET Runtime version 1.1.4322.2300- Setup Error: Failed to load resources from resource file.Please check your Setup. and was unable to do anything. In the Sitem event log ther was related warning from W3SVC: A process serving application pool 'Pool1' terminated unexpectedly. The process id was '2648'. The process exit code was '0x800703e9'. The google shows many reports(e.g www.dotnet247.com/247refere... ......

Posted On Friday, December 16, 2005 1:17 PM

One more Calendar Popup Custom Control.
I needed an Calendar Popup Control that is not cut off, if located near the the bottom of visible part of the browser window. See my implementation based on Matt Kruse JavaScript Calendar Popupcontrol (PLEASE SUPPORT HIS SITE) ......

Posted On Monday, December 5, 2005 2:26 PM

Converting existing ASP.NET Application to DotNetNuke -what is the best approach?
I've posted on ASP.NET forums the following: I have an existing ASP.NET 1.1 Application that includes more than hundred different ASPX pages and user controls (ASCX). The application consists of a number search forms, results lists and data details forms to view and edit database data. I am considering converting the application to DotNetNuke. I am looking for information what is the best approach for converting. Should I make all my User Controls be derived from Modules.PortalModuleBase or I can ......

Posted On Friday, November 18, 2005 8:30 AM

ASP.NET custom control HyperLinkWithImage
I've posted source code for the custom control that shows hyperlink and image next to each other that when clicked, will open the same URL. The standard WebControls.HyperLink shows text or image, but not both. ......

Posted On Monday, November 7, 2005 6:33 AM

Calling __doPostBack in javascript
Update: There is an existing .Net Framework method Page.GetPostBackEventReference that emits client-side script that initiates postback and also provides a reference to the control that initiated the postback event. It is well described in MSDN article “Generating Client-Side Script for Postback“. So my function should call and in most cases GetPostBackEventReference can be used directly. Original Post: I've used a function to submit postback from my javascript by passing Id of the link server control ......

Posted On Friday, November 4, 2005 2:25 PM

SetRefresh Method for ASP.NET web pages to support postback.
I've read Willem's Blog post Auto-refreshing ASP.NET web pages and desided to post my helper function SetRefresh(Page page,int nDelaySec) that is similar to suggested by Willem's third method, but supports postbacks. It's important to keep values, entered by the user before refresh. public static void SetRefresh(Page page,int nDelaySec) { // from http://groups.google.com/gr... //NOTE: Often the __doPostBack function is inserted ......

Posted On Monday, October 31, 2005 6:44 AM

To run WebDav queries against Exchange Folders from ASP.NET -use Kerberos .
I am using WebDav query to search e-mails and public folders from Exchange Server 2003. The code is based on the Visual Basic .NET sample http://msdn.microsoft.com/l... However when I started to test the code with impersonation, I ve got a problem.The scenario was the following I am using client on workstation running IE6 that login to ASP.NET web server using Windows Authentication with impersonation. The server ASP.NET ......

Posted On Tuesday, September 27, 2005 11:49 AM

Add SelectedValue property to MetaBuilders' ComboBox
I am using MetaBuilders.ComboBox[^] and recently found that I am not able to specify SelectedValue in Page_OnLoad event. The html list has “selected“ as expected , but text box is not populated with selected value. It is required to add SelectedValue to the MetaBuilders.WebControls.Co... /// /// Overrides . /// Should be overridden to addition to SelectedIndex /// public override string SelectedValue { get { return base.SelectedValue; } set { base.SelectedValue = value; // this.isLoaded ......

Posted On Thursday, September 8, 2005 11:00 AM

Response.Redirect resolves "~" root path reference.
I like to use ~ to refer to relative to root url paths.It's well described in article “Understanding Paths in ASP.NET” http://www.informit.com/art... . But I thought that it is always required to call ResolveUrl to make tilde (“~”) working. However, I found that Response.Redirect does the URL relative resolution anyway and instead of calling Response.Redirect(ResolveUR... it can be called just Response.Redirect("~/Prva.a... ......

Posted On Friday, August 19, 2005 8:39 AM

Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net