August 2006 Entries

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 ......

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 ......

Links to my photo albums

It's interesting to note,that since I've started this blog more than a year ago,it's my first personal post. I've noticed, that my photo albums on Webshots are not picked up by the Google Images. So I will provide links here and (hopefully) Google indexer will add them.(some comments are in Russian) http://community.webshots.c... http://community.webshots.c... http://community.webshots.c... http://picasaweb.google.com... ......

Intermittent execution of custom action for installation of product upgrade.

I've recently posted Custom action condition to run for a new or upgraded product., but I found that the custom action doesn't always call executable. I removed any custom action conditions, but it still doesn't always produced the same resultI had to install ORCA, and found that my Custom Action has source _5C6AF63299974A76AD78EA44FC... (reference to MSIAssembly table ) and type 1042(Custom Action Type 18 + msidbCustomActionTypeInScript 1024)The CustomAction guid key has entry in InstallExecuteSequence ......

DotNetNuke function FindControlRecursive -not clear name.

DotNetNuke has function FindControlRecursive. Initially I assumed that it search down hierarchy, but it doesn't work as I expected.After reading code it seems that it searched siblings or parens siblings up to the top of hierarchy.So the name is misleading. Fortunately there is a separate function FindControlRecursiveDown, that does what I needed ......

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 ......

Difference in HybridDictionary and Generic Dictionary Item behavior if the specified key is not found

In .Net 1.1 I've used HybridDictionary.Item and my code expected that if the specified key is not found, attempting to get it returns a null reference.But in .Net 2.0 Generic Dictionary.Item if the specified key is not found, a get operation throws a KeyNotFoundException and I have to use Dictionary.TryGetValue or check ContainsKey before calling Item. ......

Custom action condition to run for a new or upgraded product.

I have a custom action condition (in Visual Studio Web Setup Project) that I want to run for installation of a new or upgraded product. I do not want to run it on repair (and also during uninstall). First of all I tried “Not Installed” condition. But it doesn't work for version upgrade. I've tried Not Remove=”ALL” but it also doesn't work for version upgrade( it seems that deleting previous version set the property Remove=”ALL”) I've tried UPGRADINGPRODUCTCODE ......

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 ......

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... ......

.Net SQL Parser

I had a requirement to parse SQL string, in particular with CONTAINS(column_list) and modify SELECT column list.I've found two most promising implementations General SQL Parser from http://www.sqlparser.com/ and SharpHSQL from http://www.c-sharpcorner.co... article. General SQL Parser has quite qood API, but it doesn't have open source and doesn't recognize contains with column_list. SharpHSQL is a early C# port of the HSQL Database Engine which has a source code, but also doesn't ......

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 ......

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. ......

Use GUID, not IDENTITY as a primary key for tables that are required "merge-like replication”.

I have the following scenario. Vendor has a database with table having some vendor-provided data inserted. Customers have a copy of the database with ability to add new rows to the same table, but they should not delete some vendor-provided records. Periodically vendor sends patches/updates with additional records to be added to the same table. Someone can say that a better design will be to store vendor and customer data in separate tables, but the structure of both types of records is identical ......

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, ......

ImportRow to DataTable with reference to a new row

The MS .Net framework DataTable.ImportRow doesn't return reference to a new row. Also it is not documented how ImportRow will behave if record with primary keys already exist. So I've created a static "overload" of DataTable.LoadDataRow method. The common mistake that I had was that DataTable didn't have schema filled, and primary keys were empty. It caused that even existing records were considered as new, and duplicates were imported. So I've added a CheckPrimaryKey parameted, which is recommended ......

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 ......

«August»
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789