I have edit button that when users click from their profile page it redirects to page edit. if i click the button it rediects me to edit page with an error like below
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 2573: protected void userprofilestatus_DataBound(object sender, EventArgs e)
Line 2574: {
Line 2575: if (string.IsNullOrEmpty(((DataRowView)userprofilestatus.DataItem)["UserVerifyStatus"].ToString()))
Line 2576: {
code
protected void userprofilestatus_DataBound(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(((DataRowView)userprofilestatus.DataItem)["UserVerifyStatus"].ToString()))
{
Control Pnlverify = userprofilestatus.FindControl("Pnlverify");
Pnlverify.Visible = false;
}
}
html markup
<asp:FormView ID="userprofilestatus" runat="server" Width="90%" OnDataBound="userprofilestatus_DataBound">
<ItemTemplate>
<span class=" " style=" ">
<asp:Label ID="Label14" runat="server" Text='<%# Eval("UserVerifyStatus") %>' ForeColor="" Font-Size="X-Large" Font-Bold="True" Visible="false"></asp:Label>
<asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' ForeColor="" Font-Size="X-Large" Font-Bold="True"></asp:Label>
</span>
<span class=" ">
<asp:Panel ID="Pnlverify" runat="server">
<a>
<asp:Label ID="PLNHid" runat="server" CssClass="fa fa-check-circle" title="Officially verified by Arenahype." data-toggle="tooltip" Font-Size="Large " ForeColor="">
</asp:Label>
</a>
</asp:Panel>
</span>
<div class="clearfix"></div>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("UserName") %>' ForeColor="" Font-Size="Medium" Font-Bold="false"></asp:Label>
<div class="" style="margin-bottom:3px"></div>
</ItemTemplate>
</asp:FormView>