This is a migrated thread and some comments may be shown as answers.

asp:Button versus asp:LinkButton

6 Answers 446 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Kevin Warnke
Top achievements
Rank 1
Kevin Warnke asked on 07 Dec 2010, 07:05 AM
I haven't tried to reproduce this in a simpler ASPX page but in my solution if I use an asp:Button button then when the postback occurs the RadEditor1.Text value is correct and shows the changes that was made.

However, if I use an asp:LinkButton when it's clicked the post back does NOT show the chnages that was just made but rather shows the original content that was put into the rad editor.

Any thoughts?

Is there something about a LinkButton that causes the editor trouble?  This is on .NET 4.0 using the 40 library from 2010 Q2.

Thanks,
Kevin

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 07 Dec 2010, 09:23 AM
Hello Kevin,

You should not experience such a problem. I tried to reproduce the problem but without success. You can see my test in the following video: http://screencast.com/t/J7IkqBPwe2ia.

I also attached my test project. Could you please modify it at a point where the problem is reproducible and send it for examination by opening a support ticket?


Kind regards,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Kevin Warnke
Top achievements
Rank 1
answered on 07 Dec 2010, 04:39 PM
I can use your code and it does in fact work.

One thing I'm noticing that is different between my rendered code and yours is that ASP.NET wants to use "__doPostBackWithOptions()" for my link button.  That is new to me (must be new in .NET 4.0).

Does anyone know why ASP.NET uses __doPostBackWithOptions instead of just __doPostBack?  Is there a way to force just __doPostBack?  I'm wondering if that's doing something to reset the content.

Thanks,
Kevin
0
Kevin Warnke
Top achievements
Rank 1
answered on 07 Dec 2010, 05:03 PM
More info...

I was able to get rid of doPostBackWithOptions by setting CausesValidation=false on the LinkButton.  Then, when using doPostBack, things work just fine.  However, I need validation on these pages :)

Also, taking your sample, and adding a validator so that your link button starts using doPostBackWithOptions still works fine, so I'm not sure what to think now.

Thanks,
Kevin
0
Kevin Warnke
Top achievements
Rank 1
answered on 07 Dec 2010, 05:38 PM
Even more info... :)

When inspecting what is going on I put some jQuery into the mix.

When using the LinkButton (with doPostBackWithOptions) the "submit" event is NEVER fired.

Does the RadEditor depend on the "onsubmit" of a form to prepackage the contents into some hidden variable that gets used?  If so, can I call that method myself directly?

Thanks,
Kevin
0
Rumen
Telerik team
answered on 08 Dec 2010, 10:08 AM
Hi Kevin,

Does the RadEditor depend on the "onsubmit" of a form to prepackage the contents into some hidden variable that gets used?  If so, can I call that method myself directly?

Yes, exactly. The name of the method that you should call is named saveContent, e.g.

editor.saveContent(); //save the content before submission


Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Kevin Warnke
Top achievements
Rank 1
answered on 08 Dec 2010, 04:52 PM
That was what I needed, thanks!

By calling editor.saveContent() when my linkbutton click event is fired (on the client) it properly setup the data to be submitted back to the server.

Thanks,
Kevin
Tags
Editor
Asked by
Kevin Warnke
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Kevin Warnke
Top achievements
Rank 1
Share this question
or