Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using a datalist control to show per user comments.there is a comment textbox for showing comment per user in itemtemplate.now when i will click the edit command button i want that comment textbox will be enabled to edit comment text and when update is clicked that user comment will be updated.so every other comment items will stay visible only when i click edit in corresponding item the textbox will be in edit mode and then will be updated when update clicked.

in the following codes i did not use anything for edititemtemplate.please help.

<asp:DataList ID="DataList1" DataKeyField="CommentId" CssClass="MSComItem" runat="server" OnCancelCommand="DataList1_CancelCommand" OnUpdateCommand="DataList1_UpdateCommand"   
  OnEditCommand="DataList1_EditCommand">
     <itemtemplate>	
    <div style=" margin-removed130px;">
    <asp:Label ID="test" runat="server" />   
    <asp:LinkButton ID="Edit" Text="Edit" CommandName="edit" runat="server" />
     <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
    </div>
    <div id="ViewMain">
    <div id="dd" style="float:left"><asp:Image ID="logog" runat="server" ImageUrl="~/desktopmodules/mscomments/images/default_user.png" />    </div>
    <div id="arrow" style="float:left"><asp:Image ID="Image1" runat="server" ImageUrl="~/desktopmodules/mscomments/images/comment_arrow.gif" />   </div>
    <div id="ss" style="float:left"><asp:TextBox ID="Comments" Enabled="false" CssClass="textbox" BorderColor="White" BorderWidth="1px" TextMode="MultiLine" runat="server" Text='<%# Bind("Comment")%>' ></div> 
</div>
    </itemtemplate><edititemtemplate></edititemtemplate>   
Posted
Updated 12-Apr-11 23:45pm
v3

Thanks mkgoud
actually i was right with same codes in the link but was confused
 
Share this answer
 
Comments
m@dhu 14-Apr-11 1:39am    
Then why did you vote me a 1? :doh:
mridul samadder 16-Apr-11 4:56am    
you just opened my mind with those links.didn't u like my vote?
m@dhu 16-Apr-11 5:17am    
you did vote me a 1 which is least. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900