Container.DataItem and Button

V

Vishal

Hello,

I have a datagrid and need to show a simple HTML
button in a column. This button contains an OnClick event
and looks like this:

<code>
....
<ItemTemplate>
<input type="button" value="Select"
onclick="Javascript:location.href('bla.aspx?ID=<%#
Container.DataItem("ID")%>')"/>
</ItemTemplate>
....
</code>

Now when I change my view to design view in web matrix it
converts this link to:

<code>
<input type="button" value="Select"
onclick="Javascript:location.href(bla.aspx?ID=<%#
Container.DataItem("ID")% />')"/>
</code>

And ofcourse it doesnt work anymore. If I save it in the
HTML view and DONT go to the design view then it works.
However I need to switch between HTML and Design view. So
how I am supposed to get this working ?

Thanks
 
I

Isaias Formacio-Serna

I have a similar code using a Hyperlink instead of a button that works fine
and displays fine on the designer:

NavigateUrl='<%#"bla.aspx?ID=" + DataBinder.Eval(Container, "DataItem.ID")
%>'

I hope it helps.

Isaias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top