Microsoft.NET

Customize web part verb icons.

Problem 1: Customize the WebPart MinimizeVerb,RestoreVerb,CloseVerb  icon. like igoogle Solution: Set these property of webpartzone CloseVerb-ImageUrl,RestoreVerb-ImageUrl,MinimizeVerb-ImageUrl like this: <asp:WebPartZone id=”wpz” runat=”server” CloseVerb-ImageUrl=”url of close image” RestoreVerb-ImageUrl=”url of restore image” MinimizeVerb-ImageUrl=”url of minimize image”>

Replace Untitled[1], Untitled[2] to custom title from web part tile.

Problem 1: I have a container and a web part and it shows Untitled[1], Untitled[2] at the top center for each. How the heck can i remove this? It’s driving me nuts. Problem 2: when i add content to WebPartZone , for every content it is showing the header as Untitled[1],Untitled[2], and i want to Replace Untitled[1], Untitled[2] to custom title from web part tile.

Object cannot be cast from DBNull to other types

Sometimes you need to code around dates in your program. Today i will discuss about the common error we get while displaying a date from back end to front end. What if you have blank/null value inserted in your back end for date and when you get this date to front end and try to Object cannot be cast from DBNull to other types

Validate Date in dd/MM/yyyy format

Sometime we need to validate our control for proper date format in dd/MM/yyyy format. Below is the code snippet for that. Main part of code snippet is the Regular expression i used to validate. <asp:TextBox ID=”txtDate” runat=”server”></asp:TextBox> <asp:RegularExpressionValidator ID=”revDTTest” runat=”server” ControlToValidate=”txtDate” ForeColor=”Red” ErrorMessage=”Enter Valid Date in dd/mm/yyyy format.” SetFocusOnError=”True” Display=”Dynamic” ValidationExpression=”(^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$)“></asp:RegularExpressionValidator>

Convert date from dd/MM/yyyy to MM/dd/yyyy for storing in SharePoint list or Sql Server Database

I was working on a custom web part that takes the date in Indian format e.g. dd/MM/yyyy while inserting the record in SharePoint custom list. But as we know that SharePoint custom list insert the date value as MM/dd/yyyy format. So it was throwing me the error for invalid string format so below is the Convert date from dd/MM/yyyy to MM/dd/yyyy for storing in SharePoint list or Sql Server Database

Resolved: Collection was modified; enumeration operation may not execute

I was playing with a data table object, my requirement was to merge all duplicate rows to one and remove the duplicates. e.g. Book     Price Quantity Title 1 210   4 Title 1 210   6 Title 1 210   8 These were the rows inside my data table object. I want a consolidated row in place Resolved: Collection was modified; enumeration operation may not execute

Adding “Select” option as default in Dropdown List

You can add a default “Select” option in a drop down list by two ways: 1. Before loading the drop down list with data. 2. After loading the drop down with data. In first case you can do it as mentioned below: DropDownList1.AppendDataBoundItems = true; DropDownList1.Items.Add(new ListItem(“Select”, “-1”)); //Bind Your DropDownList here with data from Adding “Select” option as default in Dropdown List

Binding CheckBox with Integer value in GridView:Trick

I was working on a web part basically it was an attendance web part that contains Name and Present column only and display as GridView. Name contains the full name of employee and present contains Yes/No value for that employee. I took the present column as checkbox column that displays values using checked or unchecked. Binding CheckBox with Integer value in GridView:Trick

Microsoft .NET Terminologies at a Glance

This article defines many important terminologies that are related to Microsoft .NET so as to enable the reader to have a ready guide to the technical terms. Terminologies related to Microsoft .NET Framework, ASP.NET, ADO.NET, XML, Biztalk Server, etc. are covered.   The Common Language Specification This is a subset of the Common Type System Microsoft .NET Terminologies at a Glance

Using Command-Line Scripts in IIS 6.0

Using Command-Line Scripts in IIS 6.0 This article describes how to use command-line scripts to perform some common administrative tasks that pertain to the management of Web sites and Web virtual directories in Internet Information Services (IIS) 6.0. It also describes how to use the Iisweb.vbs script to create and delete Web sites, and how Using Command-Line Scripts in IIS 6.0