0
<asp:Repeater ID="RptrSearchedPhotographer" runat="server" 
            onitemcommand="RptrSearchedPhotographer_ItemCommand" 
            onitemdatabound="RptrSearchedPhotographer_ItemDataBound">
    <ItemTemplate>
        <tr>   
            <td>
                <asp:Label ID="LblContactInfo" runat="server" Text='<%# Eval("ContactInfo")%>'/> 
                <asp:TextBox ID="TxtContactInfo" runat="server" Text='<%#Eval("ContactInfo") %>' Visible="false" ></asp:TextBox>
            </td>
            <td>
                <asp:LinkButton ID="LnkDelete" runat="server" CommandArgument='<%#Eval("Id") %>' CommandName="delete">Delete</asp:LinkButton>
                <asp:LinkButton ID="lnkEdit" runat="server" CommandArgument='<%#Eval("Id") %>' CommandName="edit" EnableViewState ="true">Edit</asp:LinkButton>
                <asp:LinkButton ID="lnkUpdate" runat="server" CommandArgument='<%#Eval("Id") %>' CommandName="update" Visible="false" EnableViewState="true">Update</asp:LinkButton>
                <asp:LinkButton ID="LinkCancel" runat="server" CommandName="cancel" Visible="false">cancel</asp:LinkButton>
            </td>
        </tr>
    </ItemTemplate>
</asp:Repeater>

我的 .cs 代码是...

if (e.CommandName.Equals("update"))
{
    TextBox DetailNote = (TextBox)e.Item.FindControl("txtDetailNote");
    string s = DetailNote.Text;
}

s但是在这里...它给了我来自文本框的旧值。我想要在运行时插入的新值......我搜索了很多......但它不起作用......

4

1 回答 1

0

I had this issue, I solved it by adding an "if(!Page.IsPostBack)" before databinding my repeater in the page_load function.

于 2013-08-28T22:15:25.317 回答