Controls in repeaters

M

MattB

I'm using asp.net 1.1/vb.net.

I have a repeater that shows posts, like a web board type of thing.
I want to put controls on it that I may want to disable and/or hide
depending on the bound data and session state.

I've figured out how to put something like a linkbutton on there, but
how can I toggle the controls .enabled property based on the underlying
data? With an OnDataBound event? Anyone got a good example?

Thanks!

Matt
 
M

Masudur

I'm using asp.net 1.1/vb.net.

I have a repeater that shows posts, like a web board type of thing.
I want to put controls on it that I may want to disable and/or hide
depending on the bound data and session state.

I've figured out how to put something like a linkbutton on there, but
how can I toggle the controls .enabled property based on the underlying
data? With an OnDataBound event? Anyone got a good example?

Thanks!

Matt

Hi...

"how can I toggle the controls .enabled property based on the
underlying data? With an OnDataBound event?"

correct...

private void RepeaterA_ItemDataBound(object sender,
System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{

//check the condition you what to check... and then find the
control and disable it...
//you will find the databoud item in e.item.dataitem.....
}
}

Thanks
Md. Masudur Rahman (Munna)
Kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
 
M

MattB

Masudur said:
Hi...

"how can I toggle the controls .enabled property based on the
underlying data? With an OnDataBound event?"

correct...

private void RepeaterA_ItemDataBound(object sender,
System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{

//check the condition you what to check... and then find the
control and disable it...
//you will find the databoud item in e.item.dataitem.....
}
}

Thanks
Md. Masudur Rahman (Munna)
Kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com

Thanks. I'm having trouble finding the control within the repeater. The
repeater is inside a panel. I have tried this:

Dim hlDel As HyperLink =
pBottom.FindControl("Repeater1").FindControl("hlDelete")

and this:

Repeater1.FindControl("hlDelete")

and both return nothing. Can you or anyone see what I'm doing wrong? Thanks!

Matt
 
M

MattB

MattB said:
Thanks. I'm having trouble finding the control within the repeater. The
repeater is inside a panel. I have tried this:

Dim hlDel As HyperLink =
pBottom.FindControl("Repeater1").FindControl("hlDelete")

and this:

Repeater1.FindControl("hlDelete")

and both return nothing. Can you or anyone see what I'm doing wrong?
Thanks!

Matt

OK, I fixed this, but now I have another issue.
I find the hyperlink (e.Item.FindControl("hlDelete"))
I assign a target with a QueryString based on the bound data, but when I
debug, my HyperLink text is not a link, it's just text. Any ideas on that?
Thanks!

Matt
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top