When using Label and TextBox controls, we often have the need to reset the text value and/or hide the control during a post back. A common example is when using a Label control to display messages to the user. We only need to set the message once after a postback. We may then need to reset the content of that message and not display the control all together on subsequent postbacks.
To...
2/25/12
Select/UnSelect all items from CheckBoxList, DropDownList, ListBox with an Extension Method
The CheckBoxList, DropDownList and ListBox controls have an items collection based on the ListItemCollection class. To select/unselect the items on the list, we can iterate through the items in the collection and set the selected attribute to true or false.
The following code snippet shows an extension method that implements a common solution for all these controls. The method allows us to extend...
2/22/12
Insert Multiple Records in One Transaction
If you want to insert several rows into a table in one transaction, you can use the Select into statement with a combination of a select union statement. For an example, you can look at the following sample:
INSERT INTO table1(col1, col2)
SELECT 'one' ,1
UNION ALL
SELECT 'two' ,2
UNION ALL
SELECT 'three' ,3
The union statements result in three rows which are returned with two columns. The...
1/6/12
WCF Web Service Call to Another WCF Web Service returns no data
Problem Statement:I have a WCF IIS hosted web service which uses another WCF web service hosted in a different web application. The call to the other Web service always returns null or empty values on the data members of the data contract. If I call the other web service directly from a client application, the response of the service has no problem, and all the properties are populated correctly....