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

OnClientClick radopen

1 Answer 30 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 08 Sep 2013, 06:32 PM
I have a ASP:DataList with asp:Linkbutton in a ItemTemplate that i try to open a telerik:RadWindow.
I want to send a id with the url using OnClientClick="radopen

This work fine for me, i can pick upp the id 3:
<asp:Linkbutton ID="lbVisa" OnClientClick="radopen('visa.aspx?id='+'3','RadWindow1');return false;" Text="Läs mer..." runat="server" />

But i want to bind the id with the Container.DataItem in the OnClientClick="radopen, but get "The server tag is not well formed.".
<asp:Linkbutton ID="lbVisa" OnClientClick="radopen('visa.aspx?id='+'<%# DataBinder.Eval(Container.DataItem, "id") %>','RadWindow1');return false;" Text="Läs mer..." runat="server" />
What do i wrong?
Please excuse my bad english ....

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 09 Sep 2013, 02:59 PM
Hi Kjell,

You would get this error with or without any of our controls. It stems from the fact that the quotation marks around the property value of the control conflict with the quotation marks in the databound expression. You would need to either find a way to remove the quotation marks, or set the values from the code-behind, much like it it done in this online demo: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window. Note that the databound expression is not evaluated at all in the attribute property. You can examine the rendered HTML of the page and you will see something like this:
<a id="RadGrid1_ctl00_ctl10_lbVisa" onclick="radopen("visa.aspx?id="+"<%# DataBinder.Eval(Container.DataItem, "id") %>","RadWindow1");return false;" href="javascript:__doPostBack('RadGrid1$ctl00$ctl10$lbVisa','')">


Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Window
Asked by
Kjell
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or