Friday, April 17, 2009

RadGrid hide column in export

RadGrid1.MasterTableView.Columns.FindByUniqueName("ABC").Visible = false;

sorting problem - RadGrid GridTemplateColumn

my code that has problem sorting template columns:



the instruction says "the SortExpression value should match the data field you want to sort on (typically the field a control in the template is bound to)". I made sure this rule is applied but the problem remained. Then I removed the HeaderTemplate components, instead I added value to HeaderText property in the GridTemplateColumn level. This solved the problem, not sure why though.....

the new code looks like:
...........
.......

Wednesday, April 15, 2009

RadGrid Insert UserControl does not close automatically after insert

use the following code below, make sure the CommandName on the Insert Button on the UserControl is named "PerformInsert"
protected void ABC_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
{  
if (e.CommandName == "PerformInsert")  
{  
//make sure the insert user control closes automatically after inserted
e.Item.OwnerTableView.IsItemInserted = false;  
}

Tuesday, April 14, 2009

ASP.NET How to deal with the message: error connecting to undo manager of source file "........"

* Delete the .designer.cs file
* convert the .aspx or ascx file into a webapplication by right clicking on it

Checked=' < % # DataBinder.Eval( Container, "DataItem.Active" ) % >'

C# Convert String to Guid

Guid ProductID = new Guid(String)

Friday, April 03, 2009

pre-populate value into RadGrid Insert



protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName)
{
//enter the code here
}
}
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormInsertItem && RadGrid1.MasterTableView.IsItemInserted)
{
GridEditFormInsertItem insertItem = (GridEditFormInsertItem)e.Item;
(insertItem["abc"].Controls[0] as TextBox).Text = "hello world";
}
}