I have a repeater containing dropdownlists. This subroutine is called
when the selected index on one of these dropdownlists is changed...
Public Sub cmbProductType_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim cmbProductType As DropDownList = CType(sender,
DropDownList)
Dim objRepeaterItem As RepeaterItem = cmbProductType.Parent
Label1.Text =
Convert.ToString(DataBinder.Eval(objRepeaterItem.D ataItem,
"intProductID"))
End Sub
....all I'm trying to do is to simply retrieve the dataitem
"intProductID" from whichever 'row' of the repeater the dropdownlist
belongs to, but have been banging my head against a brick wall up to
now. I thought the syntax I had above would do it, but I just get a
null returned.
The equivalent syntax for an event called relating to the repeater is
'e.Item.DataItem("intProductID")', with e being the
RepeaterItemEventArgs.
I can't find any clear examples anywhere on the Internet either. Has
anyone managed to do anything like this? 3 4142
I should just clarify, when I say 'dropdownlists' I mean multiple
instances of the same one - i.e. in the ItemTemplate there is actually
just the one.
On 14 May, 15:25, champ.supern...@gmail.com wrote:
I have a repeater containing dropdownlists. This subroutine is called
when the selected index on one of these dropdownlists is changed...
Public Sub cmbProductType_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim cmbProductType As DropDownList = CType(sender,
DropDownList)
Dim objRepeaterItem As RepeaterItem = cmbProductType.Parent
Label1.Text =
Convert.ToString(DataBinder.Eval(objRepeaterItem.D ataItem,
"intProductID"))
End Sub
...all I'm trying to do is to simply retrieve the dataitem
"intProductID" from whichever 'row' of the repeater the dropdownlist
belongs to, but have been banging my head against a brick wall up to
now. I thought the syntax I had above would do it, but I just get a
null returned.
The equivalent syntax for an event called relating to the repeater is
'e.Item.DataItem("intProductID")', with e being the
RepeaterItemEventArgs.
I can't find any clear examples anywhere on the Internet either. Has
anyone managed to do anything like this?
DataItem is available only in ItemDataBound event. That is the only time
when the repeater gets connected with its datasource. You may want to get
intProductID values in a hidden html input control. You will need to include
the control into your itemtemplate.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
<ch*************@gmail.comwrote in message
news:11*********************@e51g2000hsg.googlegro ups.com...
>I have a repeater containing dropdownlists. This subroutine is called
when the selected index on one of these dropdownlists is changed...
Public Sub cmbProductType_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim cmbProductType As DropDownList = CType(sender,
DropDownList)
Dim objRepeaterItem As RepeaterItem = cmbProductType.Parent
Label1.Text =
Convert.ToString(DataBinder.Eval(objRepeaterItem.D ataItem,
"intProductID"))
End Sub
...all I'm trying to do is to simply retrieve the dataitem
"intProductID" from whichever 'row' of the repeater the dropdownlist
belongs to, but have been banging my head against a brick wall up to
now. I thought the syntax I had above would do it, but I just get a
null returned.
The equivalent syntax for an event called relating to the repeater is
'e.Item.DataItem("intProductID")', with e being the
RepeaterItemEventArgs.
I can't find any clear examples anywhere on the Internet either. Has
anyone managed to do anything like this?
Ah, that makes sense. Thanks Eliyahu, will give that a go.
On 14 May, 15:34, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
DataItem is available only in ItemDataBound event. That is the only time
when the repeater gets connected with its datasource. You may want to get
intProductID values in a hidden html input control. You will need to include
the control into your itemtemplate.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
<champ.supern...@gmail.comwrote in message
news:11*********************@e51g2000hsg.googlegro ups.com...
I have a repeater containing dropdownlists. This subroutine is called
when the selected index on one of these dropdownlists is changed...
Public Sub cmbProductType_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim cmbProductType As DropDownList = CType(sender,
DropDownList)
Dim objRepeaterItem As RepeaterItem = cmbProductType.Parent
Label1.Text =
Convert.ToString(DataBinder.Eval(objRepeaterItem.D ataItem,
"intProductID"))
End Sub
...all I'm trying to do is to simply retrieve the dataitem
"intProductID" from whichever 'row' of the repeater the dropdownlist
belongs to, but have been banging my head against a brick wall up to
now. I thought the syntax I had above would do it, but I just get a
null returned.
The equivalent syntax for an event called relating to the repeater is
'e.Item.DataItem("intProductID")', with e being the
RepeaterItemEventArgs.
I can't find any clear examples anywhere on the Internet either. Has
anyone managed to do anything like this?- Hide quoted text -
- Show quoted text -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ric carrasquilla |
last post by:
first, thx to martin for helping me with my initial post. im a newbie
and appreciate the help.
if someone can help me with another question, please do.
i have a repeater pulling job...
|
by: mrwoopey |
last post by:
I did not see code for getting all values from a repeater control
posted anywhere. So, I figured it out and I am posting for the next
person that may need it (sorry if this seems obvious to you):
...
|
by: Peter Rilling |
last post by:
In the Repeater.ItemCreated handler, I am hooking the RepeaterItem.PreRender
method. This event fires when the RepeaterItem is being rendered, the
problem is that I want access to the DataItem...
|
by: jw56578 |
last post by:
What is the explanation for the following.
if i do:
reapeter1.datasource = somedatasource
repeater1.databind()
foreach(RepeaterItem ri in repeater1.Items)
{
object o = ri.DataItem;
}
|
by: charliewest |
last post by:
Hello -
I'm using a Repeater control to render information in a very customized
grid-like table. The Repeater control is binded to a DataSet with several
records of information. Within the...
|
by: jim.long |
last post by:
I can't seem to get the checked value from the checkboxes! Is there
something wrong with the code? It loops through the repeater item
collection correctly.
HTML:
<asp:repeater id="rPrinterJobs"...
|
by: renil |
last post by:
I have a repeater control that displays info. from a datatable. Each row in
the repeater has a checkbox. Also, I have a delete linkbutton outside the
repeater control. What I'm trying to do when...
|
by: adiel_g |
last post by:
I am trying to loop through a repeater to retrieve a dataitem field
but am getting a NullReferenceException.
I can find a checkbox control but cannot find a dataitem field. Here
is the code that...
|
by: wilkinsonr |
last post by:
Hi All,
I'm having a metal blank. This is my class:
public class MyRepeaterItem : System.Web.UI.WebControls.RepeaterItem
{
public MyRepeaterItem(int itemIndex, ListItemType itemType) :...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |