วันจันทร์ที่ 21 กันยายน พ.ศ. 2558

Repeater Item Command เพื่อเรียกใช้ Control ต่างๆ ใน Repeater

Protected Sub Repeater2_ItemCommand(source As Object, e As RepeaterCommandEventArgs) Handles Repeater2.ItemCommand
        Dim rI As RepeaterItem = Me.Repeater2.Items(e.Item.ItemIndex)
        Dim txtReply As TextBox = rI.FindControl("txtReply")
        Dim ltrReply As Literal = rI.FindControl("ltrReply")
        Dim btnReply As LinkButton = rI.FindControl("btnReply")

        If e.CommandName = "btnReply" Then
            ltrReply.Text = txtReply.Text
        End If
        'If btnReply.CommandName = "" Then

        'End If

    End Sub

**********************************************
<asp:Repeater ID="Repeater2" runat="server">
<ItemTemplate>
<asp:Literal ID="ltrReply" runat="server"></asp:Literal>
<asp:TextBox ID="txtReply" runat="server" TextMode="MultiLine" </asp:TextBox>
<asp:LinkButton ID="btnReply" CommandName ="btnReply" runat="server">Post Comment</asp:LinkButton>
</ItemTemplate>
</asp:Repeater>

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

การใช้ WebClient สำหรับเรียก URL

Dim _url As String = " https :// www . MyDomain . com /?q=ทดสอบ " Dim wc As New System . Net . WebClient () wc . Encodin...