Solved

Repeater ItemCommand Question

Posted on 2007-03-24
6
2,326 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now