Friday, September 4, 2009

Tips to work in DevExpress Controls

DevExpress controls are rich in cleint side script handling. I've started using this from jun-09 onwards only. I've some points to share when you work with DevExpress controls especially ASPxGridView, ASPxCallBackPanel and ASPxPopupControl...

1. Set unique ID and ClientInstanceName for every control created in the form/user control

string strClientItemClickScript =” window.open(strURL,'Popup','toolbar=no ,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=900,height=600,left=50,top=60')” ;

menuCUSORD.ClientSideEvents.ItemClick = String.Format ("function(s, e) {{{0}}}", strClientItemClickScript);


2. Make AutoPostback property of ASPxButton control to false, when you call callback panel’s callback events through client side (Javascript) code.

3. How to add controls into an ASPxGridview cell

Create an ITemplate class
public class PeggingReqMenuTemplate : ITemplate
{
public void InstantiateIn(Control container)
{
ASPxHyperLink hp = new ASPxHyperLink();
hp.ID = "HyLink" + strHyperId;
hp.ClientInstanceName = "HyLink" + strHyperId;
container.Controls.Add(hp);
}
}

Add ITemplate class to DataItemTemplate,
private void gvSalesOrderItemPegging_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e)
{
If (e.Column.FieldName == "MaterialNo")
e.Column.DataItemTemplate = new PeggingReqMenuTemplate();
}


No comments:

Post a Comment