Tags » GridView

Custom Webpart property in Sharepoint 2013

Hi :) Today we will create a custom property for a visual webpart for Sharepoint 2013 that is mainly made for a GridView and we will set through it the pager items per page also we will add a custom validation for its user input, first in the webpart’s main .cs we will add the following: 94 more words

Display Chart in Customer Portal Using FetchXml

The below will fetch the own opportunities from crm and display it in chart based on year

CrmConnection connection = new CrmConnection("Xrm");

OrganizationService service = new OrganizationService(connection);

String fetchXML = @"fetch version='1.0' output-format='xml-platform'mapping='logical' distinct='false'>;
<entity name='opportunity'>
<attribute name='statecode' />
attribute name='customerid' />
<attribute name='actualvalue' />
<attribute name='actualclosedate' />
<attribute name='name' />
<attribute name='opportunityid' />
<attribute name='actualvalue' />
<attribute name='actualclosedate' />
<attribute name='parentcontactid' />
<order attribute='actualvalue' descending='true' />
<filter type='and'>
<condition attribute='statecode' operator='eq' value='1' />

//Creating FetchExpression
var fetchExpression = new FetchExpression(fetchXML);

//Converting FetchXml to QueryExpression
var conversionRequest = new FetchXmlToQueryExpressionRequest
FetchXml = fetchXML

var conversionResponse = (FetchXmlToQueryExpressionResponse)service.Execute(conversionRequest);

QueryExpression queryExpression = conversionResponse.Query;

//From Query Expression Retrieving Everything
EntityCollection result = service.RetrieveMultiple(queryExpression);

DataTable dTable = new DataTable();

for (int iElement = 0; iElement <= result.Entities.First().Attributes.Count - 1; iElement++)
string columnName = result.Entities.First().Attributes.Keys.ElementAt(iElement);

foreach (Entity entity in result.Entities)
DataRow dRow = dTable.NewRow();
for (int i = 0; i <= entity.Attributes.Count - 1; i++)
string colName = entity.Attributes.Keys.ElementAt(i);
if (entity.Attributes.Values.ElementAt(i).ToString() == "Microsoft.Xrm.Sdk.Money")
dRow = ((Microsoft.Xrm.Sdk.Money)entity.Attributes.Values.ElementAt(i)).Value;
else if (entity.Attributes.Values.ElementAt(i).ToString() == "Microsoft.Xrm.Sdk.EntityReference")
dRow = ((Microsoft.Xrm.Sdk.EntityReference)entity.Attributes.Values.ElementAt(i)).Name;
dRow = entity.Attributes.Values.ElementAt(i);

Chart c1 = new Chart();

Chart1.DataSource = dTable;
Chart1.Series["Series1"].XValueMember = "parentcontactid";
Chart1.Series["Series1"].YValueMembers = "actualvalue";

Chart1.Visible = true;


catch (Exception ex)


Dynamics CRM 2013

Displaying Related Data in M:M Relationships (with Additional Fields) by using GridView

This tutorial explains how to use grid view properly for displaying related entities in M:M Relationships (with Additional Fields).

When an additional field(s) is needed in M:M relationships, the relationship is decomposed into two separate 1:M relationships ( 2,317 more words

GridView Sorting ASP.NET

I have always hated Asp.NET GridView , it’s boring and stubborn , and i was asked to implement sorting for an already existing sharepoint portal full of GridViews . 94 more words


Gridview to Data Table C#

Ada kalanya kita butuh data yang sudah di manipulasi di gridview, nah… kadang kita pengen tarik data tadi buat dijadiin lagi datatable. 88 more words