So I needed to add a search box to a Microsoft Dynamics CRM Customer Portal. So into Visual Web Developer 2010 Express I went. I opened the Customer Portal project and then expanded Pages and eService in the tree.
Opening up ViewCases.aspx I located the following
1 |
<asp:GridView |
I added this before that:
1 2 |
<asp:Label ID="Label2" Font-Bold="true" runat="server"> Search: </asp:Label> <asp:TextBox ID="CaseSearch" AutoPostBack="true" runat="server"></asp:TextBox> |
I then opened the code for the file (right clicked and showed code) and located the following:
1 |
if (casesByCustomer.Count() == 0) |
and added before that:
1 2 3 4 |
if (!string.IsNullOrEmpty(CaseSearch.Text)) { casesByCustomer = casesByStatus.Where(c => c.Title.ToLower().Contains(CaseSearch.Text.ToLower().ToString())); } |
Saved the files, built the code and tested. Everything worked just fine, except for an error that occurred because the view I had, used follow up by and some of those cases didn’t have them. If a search returned only results with no follow up by set, it would give an error. But I just swapped out the follow up by for modified on.