2011-08-11 90 views
0
<asp:ListView ID="lvWallPosts" runat="server" 
     onitemcommand="lvWallPosts_ItemCommand" InsertItemPosition="LastItem"> 
    <LayoutTemplate> 
       <table cellpadding="2" runat="server" id="tblWallPosts" 
        style="width:460px"> 
        <tr runat="server" id="itemPlaceholder"> 
        </tr> 
       </table> 
      </LayoutTemplate> 
      <InsertItemTemplate> 
      <asp:TextBox ID="txtMessage" runat="server"></asp:TextBox>   
      </InsertItemTemplate> 
      <ItemTemplate> 

       <tr id="Tr2" style="height:72px" runat="server"> 
        <td valign="top" class="EmployeeInfo"> 
        <p> 
        <div class="wallmark"><asp:Image ID="imgFile" runat="server" CssClass="friendsImage" ImageUrl='<%# "HttpImageHandler.jpg?username=" + DataBinder.Eval(Container.DataItem,"ByUsername").ToString() %>' /> 
        <asp:Label ID="lblFrom" runat="server" Text='<%#Eval("ByUsername") %>' Font-Size="0.9em" Font-Underline="false" /><br /> 
        <asp:Label ID="lblMessage" runat="server" Text='<%#Eval("Message") %>' Font-Size="0.9em" Font-Underline="false"/></div> 
        <asp:LinkButton CssClass="shareText" runat="server" ID="lblComment" CommandArgument='<%# Eval("Id") %>' CommandName="Insert" Font-Size="0.9em" Font-Underline="false">Comment</asp:LinkButton> 
        <asp:LinkButton CssClass="shareText" runat="server" ID="lbShare" CommandArgument='<%# Eval("Id") %>' CommandName="Share" Font-Size="0.9em" Font-Underline="false">Share</asp:LinkButton> 
        </td> 
       </tr> 
      </ItemTemplate> 

    </asp:ListView> 

當我點擊linkbutton評論時無法看到txtMessage控件。帶有InsertItemTemplate的ListView不起作用

回答

0

嘗試設置LinkBut​​ton的命令名以「InitInsert」,而不是「插入」