Solved

Repeater ItemCommand Question

Posted on 2007-03-24
6
2,334 Views
Last Modified: 2008-03-17
Hi

I am trying to access several DataItems through the ItemCommand of an Repeater when clicking on a LinkButton e.g

Dim my_id As String
my_id = DataBinder.Eval(e.Item.DataItem, "comp_main_id")

But it gives me always and empty string!

Can anybody help me here?

Thanks, Mike.
0
Comment
Question by:mgasft
  • 3
6 Comments
 
LVL 6

Accepted Solution

by:
sara110 earned 250 total points
ID: 18788256
you know repeater is not very powerful when you want to use button or ... items which you want it to have action, I prefer datalist because it use the primary key as datakey and therefore you could access all of your items and controls in that datalist.
datalist1.DataKeys.Item(e.Item.ItemIndex)
and something like this... ,
http://www.velocityreviews.com/forums/t118666-problem-with-eitemdataitem-in-onitemdatabound.html
0
 
LVL 15

Assisted Solution

by:igor_alpha
igor_alpha earned 250 total points
ID: 18789946
Hi mgasft,

The problem that on ItemCommand even't e.Item.DataItem actually is null. So you can't get value of dataitem.
Walkaround is using of e.Item.Controls property.
For example, if you have lblCompMainID in Repeater you can get value of its Text property:

Dim l1 As Label
l1 = e.Item.Controls .FindControl("lblCompMainID")
'here you have l1.Text
0
 

Author Comment

by:mgasft
ID: 18828862
Hi

It seems that the Repeater has no FindControl?

Mike
0
 
LVL 15

Expert Comment

by:igor_alpha
ID: 18833552
Repeater have FindControl() method.
0
 
LVL 15

Expert Comment

by:igor_alpha
ID: 19165622
My walkaround with label control seems like solution.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question