Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Select Row by javascript in Datalist

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alhambra Eidos Kiquenet - 20 Aug 2007 10:22 GMT
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.

Signature

http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
www.trabajobasura.com/solusoft

Eliyahu Goldin - 20 Aug 2007 10:56 GMT
function selectRow(row){
// do here what you need, for example set a css style for the row background
}

<tr onclick="selectRow (this)">

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> Hi misters,
>
[quoted text clipped - 32 lines]
>
> Thanks in advance, regards, greetings.
Ladislav Mrnka - 20 Aug 2007 15:04 GMT
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

> Hi misters,
>
[quoted text clipped - 31 lines]
>
> Thanks in advance, regards, greetings.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.