Hello,
I am use repeater control and i that i have a label so i am assign value to this label in code behind but system gives error threw an exception of type system nullreferenceexception c#
This is my aspx code
- <asp:Repeater ID="Repeater1" runat="server">
- <HeaderTemplate>
- <table>
- HeaderTemplate>
- <ItemTemplate>
- <tr>
- <td>
- <asp:Label ID="lbldata" runat="server">asp:Label>
- td>
- tr>
- ItemTemplate>
- <FooterTemplate>
- table>
- FooterTemplate>
- asp:Repeater>
- DataTable dt_OwnerFilter = new DataTable();
- Label r1 = (Label)Page.FindControl("lbldata");
- dt_OwnerFilter = bl.BL_FetchOwnerInfo(bo);
- pgsource.DataSource = dt_OwnerFilter.DefaultView;
- lblfetchdata.Text = string.Empty;
- int i = 1;
- foreach (DataRow dRow in dt_OwnerFilter.Rows)
- {
- if (dt_OwnerFilter.Rows.Count > 0)
- {
- string htmlcode = "";
- htmlcode = " + dRow["PropertyDetailsId"] + ")'> " + i + "";
- r1.Text += htmlcode + "
"; //// Here is error - }
- i = i + 1;
- }


Bryian TanRank #396 · 6.3K reputationPosted Nov 16, 2017, 7:30 PM EST
Nilesh PatilRank #1,129 · 1.6K reputationPosted Nov 16, 2017, 7:33 PM EST
Bryian TanRank #396 · 6.3K reputationPosted Nov 16, 2017, 8:05 PM EST