Hi there. I have a Comment.aspx page on which I allow users to write/edit comment.
I have tinyMce on that page.
When edit is clicked on the Thread.aspx page, Comment.aspx opens. In its page Load it obtains the comment (from db) for comment to be edited (comment Id is sent by the Thead.aspx in querystring) and put that comment in TinyMce TextArea, so that user can
edit that comment.
However, when user edits the comment and then clicks the Post "linkbutton", instead of calling linkbutton's Click event directly, it first calls PageLoad of Comment.aspx which re-initializes the text in tinymce's text area. It then calls linkbutton's click
event handler which then accesses the reinitialized comment. Hence the comment doesnt gets updated in the database.
I am sure I am missing some small thing. Should I post the code.
Exactly what I needed(/missed ;) ). I am not much experienced developer. So I miss some things. But thank you, people here from community add some serious knowledge to me. Thanks a lot.
I am trying to create a page where people can post comments on images, could you possibly lead me in the direction of doing this? I am new to asp.net and any help would be greatly appreciated.
Mahesha999
Member
147 Points
101 Posts
Clicking on link button first calls page load
Mar 31, 2012 07:49 PM|LINK
Hi there. I have a Comment.aspx page on which I allow users to write/edit comment.
I have tinyMce on that page.
When edit is clicked on the Thread.aspx page, Comment.aspx opens. In its page Load it obtains the comment (from db) for comment to be edited (comment Id is sent by the Thead.aspx in querystring) and put that comment in TinyMce TextArea, so that user can edit that comment.
However, when user edits the comment and then clicks the Post "linkbutton", instead of calling linkbutton's Click event directly, it first calls PageLoad of Comment.aspx which re-initializes the text in tinymce's text area. It then calls linkbutton's click event handler which then accesses the reinitialized comment. Hence the comment doesnt gets updated in the database.
I am sure I am missing some small thing. Should I post the code.
Please help. Thank you.
sujithkumar
Contributor
3024 Points
563 Posts
Re: Clicking on link button first calls page load
Mar 31, 2012 08:34 PM|LINK
hi,
even ever you perform any operationall the phases of asp.net web page( life cycle) will be called...follwing are life cycle events...
so when ever you bind the data first time, just check !page.IspostBack and bind the data....
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// your code
}
}
hope this will help you...
Mahesha999
Member
147 Points
101 Posts
Re: Clicking on link button first calls page load
Apr 01, 2012 07:01 PM|LINK
Exactly what I needed(/missed ;) ). I am not much experienced developer. So I miss some things. But thank you, people here from community add some serious knowledge to me. Thanks a lot.
cbramme
Member
2 Points
2 Posts
Re: Clicking on link button first calls page load
Nov 17, 2012 06:42 AM|LINK
I am trying to create a page where people can post comments on images, could you possibly lead me in the direction of doing this? I am new to asp.net and any help would be greatly appreciated.