Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

How to retrieve case record and display in gridview in asp.net

$
0
0

Hi,

I have retrieved case record when I retrieve description value of case then error is occurred "the given key was not present in the dictionary". Please tell me how to resolve this issue

Here is my code 

  QueryExpression query1 = new QueryExpression("incident");
                query1.ColumnSet.AddColumns("title","description", "createdon");

                query1.Criteria = new FilterExpression();
              
                query1.Criteria.AddCondition("customeridname", ConditionOperator.Equal, lblUser.Text);


               
                EntityCollection result = serviceProxy.RetrieveMultiple(query1);
             
                DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                dt.Columns.Add("Customer");
                dt.Columns.Add("Title");
             
                dt.Columns.Add("Description");
                dt.Columns.Add("Created On");

                foreach (Entity entities in result.Entities)
                {
                 
                    DataRow dr = dt.NewRow();
                    dr["Title"] = entities.Attributes["title"].ToString();
                    dr["Description"] = entities.Attributes["description"].ToString();
                    dr["Created On"] = entities.Attributes["createdon"].ToString();
                   dr["Customer"] = lblUser.Text;
                  
                    dt.Rows.Add(dr);


                }

                ds.Tables.Add(dt);

                ordergrid.DataSource = ds;
                ordergrid.DataBind();
           


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>