Solved

Repeater ItemCommand Question

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

636 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