getting info to a UserControl?

H

HockeyFan

I'm having trouble getting information passed to a UserControl that I
wrote.
Within the control is an ObjectDataSource that populates a GridView on
the control. The Select method for the ObjectDataSource gets invoked
prior to almost anything else going on with the control, so the
GridView isn't available yet. No public properties seem to be
available yet. I put a hidden field on the control, but it's not
available yet.
Within that Select method, I need to get a value from the Repeater
item that the control is on. How might I do this? I'm just wanting
to pass an integer.
 
G

Guest

I'm having trouble getting information passed to a UserControl that I
wrote.
Within the control is an ObjectDataSource that populates a GridView on
the control. The Select method for the ObjectDataSource gets invoked
prior to almost anything else going on with the control, so the
GridView isn't available yet. No public properties seem to be
available yet. I put a hidden field on the control, but it's not
available yet.
Within that Select method, I need to get a value from the Repeater
item that the control is on. How might I do this? I'm just wanting
to pass an integer.


I think a public property could help

private int _selectid;

[Bindable(true), Category("Behavior"), Description("...")]
public int SelectId
{
get
{
return _selectid;
}
set
{
_selectid= value;
}
}

add this in your class

and use the _selectid in your SELECT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top