Showing posts with label Infragistics. Show all posts
Showing posts with label Infragistics. Show all posts

Monday, September 11, 2017

Add or Remove a Column to a WebDataGrid

I have been using Infragistics for long, I have gone through this scenario many times. Hope this helps few people.  The following code shows you how to add bound data field and a template data field.


private void AddReferenceFieldColumnstoWebGrid()
        {
            DataTable dtConfigureReffields = crBl.GetConfigureReferenceFields(intCompanyId, intAccountId);

            // NS: Commenting
            // Adding colums dynamically.
            // if we matched these column kyes with grid result
            // binding will take care automatically
            string strReferenceFieldName;
            int intOffset = 11;  // position where to start after ref field. 
             //this is the place where we add these columns. for me i will get dynamic columns
             // from the datatable.
            for (int j = 0; j < dtConfigureReffields.Rows.Count; j++)
            {
                strReferenceFieldName = "";
                BoundDataField boundField1 = new BoundDataField(true);
                strReferenceFieldName = "reference" + (j + 2);
                boundField1.Key = strReferenceFieldName;
                boundField1.Header.Text = dtConfigureReffields.Rows[j]["name"].ToString();
                boundField1.DataFieldName = strReferenceFieldName;

                // ADD COLUMNS
                this.referenceFieldApprovalQueueUltraWebGrid.Columns.Insert(intOffset, boundField1);
                intOffset++;
            }
        } 
    

To remove column for the grid, add this below code after databind of webdatagrid.

// REMOVE COLUMNS
this.WebDataGrid1.Columns.Remove(this.WebDataGrid1.Columns["Ref1"]);   

Thursday, February 23, 2012

Infragistics: How to set Application Styling settings through Web.Config

You can use the AppStyling Visual Studio Add-in which is available from the Tools menu in Visual Studio or alternatively, you can manually add the settings into your web.config as seen below.
<configSections>  
   <section name="infragistics.web" 
type="System.Configuration.SingleTagSectionHandler,System, Version=1.0.3300.0, 
Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
</configSections>
<infragistics.web styleSetName="ElectricBlue" styleSetPath="~/ig_res" 
enableAppStyling="true" />


Good luck

Wednesday, February 15, 2012

How to: WebDataGrid paging when there are more pages

QuickPages is a method of paging which will give links to a limited number of pages before and after the current page index.   Below is an example of the Paging behavior which is setup to display 3 quick pages along with a "First" and "Last" quick link.  This setup provides the best user experience for paged records which return more than 8 pages of data.

<ig:Paging PagerAppearance="Both" PagerMode="NumericFirstLast" 
QuickPages="3" PageSize="20"
FirstPageText="First" LastPageText="Last" >
</ig:Paging>

Hope this helps!