How to write it??

  • Thread starter Thread starter Alberto
  • Start date Start date
A

Alberto

I have an imageButton in a aspx page inside a DataList. The image on its
surface it's loaded on runtime doing this:

<asp:ImageButton id=.... ImageUrl='<%# DataBinder.Eval(Container.DataItem,
"Path")%>'

Now I'd like to make a Response.Redirect(...) when the user makes a clic on
the image but I don't know how to write it. I'm doing this:

<asp:ImageButton ... OnClick="Response.Redirect('<%#
DataBinder.Eval(Container.DataItem, "Page")%>')

but it doesn't work.
 
I think ImageButtons are a little more than you need to be using. If you want to show the image when they click on it, just use an image control.

<asp:Image id=.... ImageUrl='<%# DataBinder.Eval(Container.DataItem, "Path")%>' onClick='<# DataBinder.Eval(Container.DataItem, "Path")%>' />

--Michael
 
Sorry. What I want is show another page with the photo bigger. What I don't
know how to do is how to write the response.redirect sentence inside de html
code.

"Raterus" <[email protected]> escribió en el mensaje
I think ImageButtons are a little more than you need to be using. If you
want to show the image when they click on it, just use an image control.

<asp:Image id=.... ImageUrl='<%# DataBinder.Eval(Container.DataItem,
"Path")%>' onClick='<# DataBinder.Eval(Container.DataItem, "Path")%>' />

--Michael
 
Oh I'm sorry, I didn't even tell you the answer!

<asp:Image id=.... ImageUrl='<%# DataBinder.Eval(Container.DataItem,
"Path")%>' onClick="location.href='<# DataBinder.Eval(Container.DataItem, "Path")%>';" />
 
I'm trying it but there is an error when I open the page. I suppose there is
a problem with the ' or the " but I don't know where. Thank you.

"Raterus" <[email protected]> escribió en el mensaje
Oh I'm sorry, I didn't even tell you the answer!

<asp:Image id=.... ImageUrl='<%# DataBinder.Eval(Container.DataItem,
"Path")%>' onClick="location.href='<# DataBinder.Eval(Container.DataItem,
"Path")%>';" />
 
You gotta make use the URL you're going to is well-formed, it can be
alsolute or relative.
 
Back
Top