Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Repeater ItemCommand Question

Posted on 2007-03-24
6
Medium Priority
?
2,360 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 6

Accepted Solution

by:
sara110 earned 750 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 750 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

688 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