Saturday, August 14, 2010

Wildcard on Postgresql Full Text Search

Note these two characters: :*

select x.y, to_tsvector('english',x.y) @@ to_tsquery('english','quic:*') as match
from (values
('The quick brown fox jumps over the lazy dog')) as x(y)

Output:
y                                            | match
---------------------------------------------+-------
 The quick brown fox jumps over the lazy dog | t
(1 row)

Setting RadGrid's ConfirmText programatically

var gbc = grdCategory.MasterTableView.GetColumn("uxDelete") as GridButtonColumn;
bc.ConfirmText = "Are you sure you want to delete??";

Tuesday, August 10, 2010

Cookie to the rescue

Turns out that the solution for preventing the PanelItem from collapsing as suggested from Telerik Knowledge Base is not working


The following works:
protected void Page_Load(object sender, EventArgs e)
{
    RadPanelBar1.PersistStateInCookie = true;
}

Monday, August 9, 2010

Simpler way to get the selected RadGrid row's primary key and description(or other fields)

Much simpler than SelectedIndexChanged

protected void grdCategory_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.Item is GridDataItem)
    {                
        var item = (GridDataItem)e.Item;
        TextBox1.Text = item["category_description"].Text;         
        TextBox2.Text = item.GetDataKeyValue("category_id").ToString();
    }
}

Attaching javascript to a TextBox in ASP.NET

TextBox2.Attributes.Add("onclick","alert('hello')");