Select Row by javascript in Datalist

G

Guest

Hi misters,

I have Datalist like this:

....
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" id="tbl"><tbody>
</HeaderTemplate>
<ItemTemplate>

<tr id="<%# "filaListado" + Eval("idtareasworkflow") %>"
onclick="SelectRow('<%# Eval("idtareasworkflow") %>', <%# "'" +
Eval("Offset") + "'" %>);"
<%# EstiloFilaJavaScript(Container) %>
class="<%# Container.ItemIndex % 2 == 0 ? "ItemStyle" :
"AlternatingItemStyle" %>"
....

Now, it want to access to Row of Item Template. I put attribute runat=server.

I can't bind to ID property if it's runat=server, isn't?

I have this code, now:

<tr id="rowDatalist"
runat="server"
onclick="SelectRow ????"

How I implement my javascript function SelectRow ? Which parameters of js
function ? I want to access to row, but the id of TR is dynamic, isn't? It
would be neccesary something like similar ClientID.

any help for me? I will be grateful for any comments, help...

Thanks in advance, regards, greetings.
 
G

Guest

Hi,
I think you are using wrong component to achieve your requirements. You are
trying to render html table at your own, but DataList also renders its
content to html table. That means result of your page will not be HTML valid.
It will look like:

<table>
<tr>
<td>
<!-- here will be your header template -->
<table cellpadding="0" cellspacing="0" id="tbl"><tbody>
</td>
</tr>
<tr>
<td>
<!-- here will be your first item -->
<td>
...
</td>
</td>
</tr>
etc.

If you want to control table rendering at your own you have to use Repeater
control.

Regards,
Ladislav
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top