将DataBound vb代码中的值或项传输到Repeater ASP Page

时间:2018-05-30 19:46:35

标签: asp.net vb.net

enter image description here受保护的子rptRps_ItemDataBound(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)处理rptRps.ItemDataBound

      If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then

            Dim valueReceived As Integer = CType((CType(e.Item.DataItem, DataRowView))("netValue"), Integer)

            If valueReceived < 0 Then

                CType(e.Item.FindControl("trItemr00"), HtmlTable).Style.Add("litLastestLog", "whatever")

                'CType(e.Item.FindControl("litLastestLog"), Label).Text = "whatever"

            End If

        End If


**********************************
<asp:Repeater ID="rptRps" runat="server" OnItemDataBound="rptRps_ItemDataBound" OnItemCommand="rptRps_ItemCommand">
            <HeaderTemplate>
                <table id="tbLegenda" runat="server" border="0" cellpadding="0" cellspacing="0" style="width: 100%; vertical-align: top">
.
.
.
               <td class="funHeader" style="width: 25%">
                            <asp:Literal ID="lit2LastestLog" runat="server" Text="Descr Log"></asp:Literal>
                        </td>
.
.
.

 <td class="RepeaterItemCell_m" style="width: 4%; text-align: center">
                        <%# DataBinder.Eval(Container.DataItem, "LastDescrLog").ToString%>
                    </td>

当我运行conde时显示此消息“对象引用未设置为对象的实例”。 我不知道我做了什么...... 我想在这里展示新消息。

 <td class="RepeaterItemCell_m" style="width: 4%; text-align: center">
                        <%# DataBinder.Eval(Container.DataItem, "LastDescrLog").ToString%>
                    </td>

enter image description here

0 个答案:

没有答案