Archive for Giugno 26th, 2008

Drop Down Tooltip

CodeKeep C# Feed Giugno 26th, 2008

Description: Add Tooltip to dropdown list

Link: http://www.codekeep.net/snippets/ba1a41c6-aec9-40b4-80ff-9e4021ecd97e.aspx

  this.ddlMeasure.Attributes.Add("onMouseOver", string.Format("var tip = document.getElementById('{0}'); tip.innerHTML = this.options[this.selectedIndex].title;tip.style.display = '';", this.ClientID + "_tooltip"));
            this.ddlMeasure.Attributes.Add("onMouseOut", string.Format("document.getElementById('{0}').style.display = 'none';", this.ClientID + "_tooltip"));        
            writer.Write(string.Format("<SPAN id='{0}' style='BORDER:#646464 1px solid; z-index:1000; Margin-left:200px; PADDING-RIGHT:3px; DISPLAY:none; PADDING-LEFT:3px;FONT-SIZE:10px; Font-weight:normal;  PADDING-BOTTOM:3px; PADDING-TOP:3px; FONT-FAMILY:Verdana; BACKGROUND-COLOR:#FAFAFA; Color:#646464; Position:absolute;'></SPAN>", this.ClientID + "_tooltip"));

DB2Transaction

CodeKeep C# Feed Giugno 26th, 2008

Description: Code snippet for db2 transaction

Link: http://www.codekeep.net/snippets/379350b6-26af-4560-a5a7-be809e655118.aspx

            using(DB2Connection connection = new DB2Connection(ConnectionString))
            {
                connection.Open();
                using(DB2Transaction transaction = connection.BeginTransaction())
                {
                    try
                    {
                        transaction.Commit();
                    }
                    catch
                    {
                        if(transaction != null)
                            transaction.Rollback();
                        throw;
                    }
                }
            }