I am very sorry for coming here so much.
Without your help, my project would have been a major failure.
Thank you very much.
Right now, I am struggling to populate Repeater control with data from the database.
I have a repeater control called Repeater1.
My stored procedure pulls data from the database and I use C# to try to populate the repeater control.
The C# code I am using is provided by AnandM's kindness.
Right now, I am getting an error that says:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'MarineRegNo'.
I am struggling to fix this issue.
Can you please help one more time?
As always, thanks a lot for your help.
//Stored procedure
ALTER PROCEDURE [dbo].[uspGetMarineRecs] @pin int
AS
SET NOCOUNT ON;
begin
select MarineRegNo, VesselRegNo, TaxPyrRetdVal,VesselTaxPyrRetdVal
FROM MarineInfo
WHERE pid = @pin
end
//Markup
<ItemTemplate>
<tr>
<td>
<asp:TextBox ID="txtboatregNum" runat="server" Text='<%# Eval("MarineRegNo") %>' placeholder="Enter registration #..." Style="width: 450px;" class="form-control"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtPayerret" runat="server" placeholder="Enter returned value as of Jan. 1..." Style="width: 400px;" class="form-control txtPayerret"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="cgaurdNumber" runat="server" placeholder="Enter Coast Guard #..." Style="width: 450px;" class="form-control"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="cguardreturnedval" runat="server" placeholder="Enter returned value as of Jan. 1..." Style="width: 400px;" class="form-control txtPayerret"></asp:TextBox>
</td>
</tr>
</ItemTemplate>
//C#
private void getMarineRecs(int pin)
{
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("uspGetMarineRecs", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("@pin", pin);
cmd.Parameters.Add(p1);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dtPreviousRecords = new DataTable();
sda.Fill(dtPreviousRecords);
Repeater1.DataSource = dtPreviousRecords;
Repeater1.DataBind();
//conn.Open();
}