I created a cms module and added class named Company (namespace = Tech)
I have a UniGrid control like this:
<cms:UniGrid ID="companyGrid" runat="server" ObjectType="Tech.Company">
<GridActions Parameters="CompanyID">
<ug:Action Name="edit" Caption="$General.Edit$" FontIconClass="icon-edit" FontIconStyle="allow" CommandArgument="CompanyGuid" />
<ug:Action Name="#delete" Caption="$General.Delete$" FontIconClass="icon-bin" FontIconStyle="critical" Confirmation="$General.ConfirmDelete$" />
</GridActions>
<GridColumns>
<ug:Column Source="CompanyName" Caption="Company Name" Localize="true" runat="server">
<Filter Type="Text" Size="256" />
</ug:Column>
<ug:Column Source="State" Caption="State" Localize="true" runat="server">
<Filter Type="Text" Size="256" />
</ug:Column>
<ug:Column Source="Country" Caption="Country" Localize="true" runat="server">
<Filter Type="Text" Size="256" />
</ug:Column>
<ug:Column Source="WebsiteURL" Caption="Website URL" Localize="true" runat="server">
<Filter Type="Text" Size="256" />
</ug:Column>
</GridColumns>
<GridOptions DisplayFilter="true" />
</cms:UniGrid>
There is my OnAction code:
protected void companyGrid_OnAction(string actionName, object actionArgument)
{
string guid = ValidationHelper.GetString(actionArgument, string.Empty);
if (actionName == "edit")
{
Response.Redirect("~/CMSModules/Tech/Companies/Edit.aspx?guid=" + guid);
}
}
I am trying to find a record in table using following lines:
string guid = Request.QueryString["id"];
try
{
//companyInfo = CompanyInfoProvider.GetCompanyInfo(new Guid(guid));
companyInfo = CompanyInfoProvider.GetCompanyInfo(ValidationHelper.GetGuid(guid, Guid.NewGuid()));
//LoadData();
}
catch (Exception ex)
{
lblMessage.Text = ">> " + (companyInfo == null);
}
The value of guid I get is: 098f8ef1-64fc-427d-91a5-1ec2e2da131f
I always get >> True in my label, means companyInfo is always null.
If I try to execute manual query, it finds the record.
While generating the code files, I tried all possibilities:
Guid Column => CompanyGuid
Display name column => CompanyGuid
Code name column => CompanyGuid
What am I doing wrong?