dynamic HTML

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I got a grid list the record, column1 is "number"
When the user press colunn 1 , i want to show out the pdf file whose
filename is same as column1's contents
How can I do that ?? thanks a lot
<a href="<%# DataBinder.Eval(Container.DataItem, "number") %>.pdf > <%#
DataBinder.Eval(Container.DataItem, "number") %></a>
 
There are a couple of ways to bind:

1. DataBinder.Eval = If you choose this method, you use single quotes in the
HTML attributes and double qutoes for the method
2. Create a method in the page and bind. In this instance, you have the page
respond. It will actually be a bad idea in your instance.
3. Use the Data Binding event to fill the link.
4. Use a hyperlink column

Of the many choices, #4 is easiest in a Grid control or List control. You
add a hyperlink column and bind to number. you then set up the hyperlink
format string and the text format string, if you want it to say something
different than the file name.

If this is a non-option (custom grid, for example), you can use the data
binding event and dynamically add the hyperlink. As long as you do not need
to control the hyperlink on postback, which is a bit difficult in custom
binding, you will be fine.

What you have is simple binding, which is probably overkill for the type of
grid or list you are using.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside the box!
*************************************************
 
Back
Top