I added a field in the membership request webpart:
Other codes I have added were mirrored with the FirstName field.
<tr>
<td align="right">
<asp:Label ID="PrimaryCompanyLabel" AssociatedControlID="PrimaryCompany" runat="server" /></td>
<td>
<asp:TextBox ID="PrimaryCompany" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="PrimaryCompanyRequired" runat="server" ControlToValidate="PrimaryCompany" Display="Dynamic"></asp:RequiredFieldValidator></td>
</tr>
I then added code in the MembershipRequestControl.cs to access the value of the new textbox:private IEditableTextControl _txtPrimaryCompany;
protected IEditableTextControl txtPrimaryCompany
{
get
{
if (_txtPrimaryCompany == null)
{
_txtPrimaryCompany = (IEditableTextControl)this.CompleteStep.ContentTemplateContainer.FindControl("PrimaryCompany");
}
return _txtPrimaryCompany;
}
}
Unfortunately, the code above is throwing a null reference exception. Am I missing something?Other codes I have added were mirrored with the FirstName field.