Reputation: 259
i have :
DataTable docTags;
List<IR_TagsName> tags = SomeClass.ShowTagsName(docIdentity);
foreach (DataRow dr in docTags.Rows)
{
foreach (IR_TagsName tag in tags)
{
if (dr["TagName"].ToString() == tag.TagName)
{
dr["TagValue"] = tag.RequestID;
}
}
}
TagsRepeater.DataSource = docTags;
TagsRepeater.DataBind();
and Repeater code is :
<asp:Repeater ID="TagsRepeater" runat="server">
<ItemTemplate>
<div class="inputWrap">
<asp:Label ID="Label2" runat="server" AssociatedControlID="Tags"><%#DataBinder.Eval(Container.DataItem, "TagDescription")%>: </asp:Label>
<asp:HiddenField ID="TagName" runat="server" Value='<%#DataBinder.Eval(Container.DataItem, "TagName")%>' />
<asp:HiddenField ID="TagDataType" runat="server" Value='<%#DataBinder.Eval(Container.DataItem, "TagDataType")%>' />
<asp:TextBox ID="Tags" runat="server" Width="300" ReadOnly="true" Text='<%#DataBinder.Eval(Container.DataItem, "TagValue")%>' CssClass='<%# String.Format("Tag{0}", DataBinder.Eval(Container.DataItem, "TagName")) %>' />
<asp:Panel ID="ScriptPanel" runat="server" Visible='<%#(DataBinder.Eval(Container.DataItem, "tagdatatype").ToString() == "4" ? true : false)%>'>
<script type="text/jscript">
$(function () {
$(".Tag<%#DataBinder.Eval(Container.DataItem, "TagName")%>").datepicker({dateFormat: "dd.mm.yy"});
});
</script>
</asp:Panel>
</div>
</ItemTemplate>
</asp:Repeater>
this give me exception : DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'TagValue'.
I am not sure is this a right way to loop DataRow and set List variables...If it's need i will post more details
Upvotes: 0
Views: 758
Reputation: 32681
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'TagValue'
Your exception details are self-explanatory. In your dr
you don't have a field names ad TagValue
. When you try to access it you get exception.
Verify the name of the field and change it. perhaps you want to return from database and forgot or the name is different.
Upvotes: 2